pub struct LSTM { /* private fields */ }
Expand description
A Long Short-Term Memory (LSTM) layer.
Implementations§
source§impl LSTM
impl LSTM
sourcepub fn new(
in_dim: usize,
hidden_dim: usize,
config: LSTMConfig,
vb: VarBuilder<'_>,
) -> Result<Self>
pub fn new( in_dim: usize, hidden_dim: usize, config: LSTMConfig, vb: VarBuilder<'_>, ) -> Result<Self>
Creates a LSTM layer.
pub fn config(&self) -> &LSTMConfig
Trait Implementations§
source§impl RNN for LSTM
impl RNN for LSTM
type State = LSTMState
source§fn zero_state(&self, batch_dim: usize) -> Result<Self::State>
fn zero_state(&self, batch_dim: usize) -> Result<Self::State>
A zero state from which the recurrent network is usually initialized.
source§fn step(&self, input: &Tensor, in_state: &Self::State) -> Result<Self::State>
fn step(&self, input: &Tensor, in_state: &Self::State) -> Result<Self::State>
Applies a single step of the recurrent network. Read more
source§fn states_to_tensor(&self, states: &[Self::State]) -> Result<Tensor>
fn states_to_tensor(&self, states: &[Self::State]) -> Result<Tensor>
Converts a sequence of state to a tensor.
Auto Trait Implementations§
impl Freeze for LSTM
impl !RefUnwindSafe for LSTM
impl Send for LSTM
impl Sync for LSTM
impl Unpin for LSTM
impl !UnwindSafe for LSTM
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)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