pub trait RNN {
type State;
fn zero_state(&self, batch_dim: i64) -> Self::State;
fn step(&self, input: &Tensor, state: &Self::State) -> Self::State;
fn seq_init(
&self,
input: &Tensor,
state: &Self::State
) -> (Tensor, Self::State);
fn seq(&self, input: &Tensor) -> (Tensor, Self::State) { ... }
}
Expand description
Trait for Recurrent Neural Networks.
Required Associated Types
Required Methods
fn zero_state(&self, batch_dim: i64) -> Self::State
fn zero_state(&self, batch_dim: i64) -> Self::State
A zero state from which the recurrent network is usually initialized.
Applies a single step of the recurrent network.
The input should have dimensions [batch_size, features].