pub struct LSTMCell {
pub weight_ih: Tensor,
pub weight_hh: Tensor,
pub bias_ih: Tensor,
pub bias_hh: Tensor,
/* private fields */
}Expand description
LSTM cell with PyTorch’s [i, f, g, o] gate order.
weight_ih shape: [4*hidden, input]; weight_hh shape: [4*hidden, hidden].
bias_ih and bias_hh both [4*hidden] — summed in Self::step to match
nn.LSTM’s packing, so PyTorch checkpoints load without remapping.
Not a Layer — cells take (x, h, c), not a single tensor.
Fields§
§weight_ih: Tensor§weight_hh: Tensor§bias_ih: Tensor§bias_hh: TensorImplementations§
Source§impl LSTMCell
impl LSTMCell
Sourcepub fn new(
weight_ih: Tensor,
weight_hh: Tensor,
bias_ih: Tensor,
bias_hh: Tensor,
) -> Self
pub fn new( weight_ih: Tensor, weight_hh: Tensor, bias_ih: Tensor, bias_hh: Tensor, ) -> Self
Create an LSTM cell from existing weight/bias tensors. hidden_size is
derived from weight_ih.shape()[0] / 4.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for LSTMCell
impl !RefUnwindSafe for LSTMCell
impl Send for LSTMCell
impl Sync for LSTMCell
impl Unpin for LSTMCell
impl UnsafeUnpin for LSTMCell
impl !UnwindSafe for LSTMCell
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more