logo

Struct neuronika::nn::LSTMCell[][src]

pub struct LSTMCell {
    pub weight_ih: Learnable<Ix2>,
    pub weight_hh: Learnable<Ix2>,
    pub bias_ih: Learnable<Ix1>,
    pub bias_hh: Learnable<Ix1>,
}
Expand description

A long short-term memory (LSTM) cell.

Fields

weight_ih: Learnable<Ix2>weight_hh: Learnable<Ix2>bias_ih: Learnable<Ix1>bias_hh: Learnable<Ix1>

Implementations

Creates a new LSTMCell.

Arguments
  • input_size - number of expected features in the input.

  • hidden_size - number of features in the hidden state.

All the weight and biases are initialized from U(-k, k) where k = (1. / hidden_size as f32).sqrt().

Computes a single LSTM step.

Arguments
  • state - a tuple of tensors, both of shape (batch, hidden_size), containing the initial hidden state for each element in the batch and the initial cell’s state for each element in the batch.

  • input - a variable containing the input features of shape (batch, input_size).

The output is a tuple of tensors made of the next hidden state for each element in the batch, of shape (batch, hidden_size) and the next cell’s state for each element in the batch, of shape (batch, hidden_size).

Trait Implementations

Registers the weights and the biases of this LSTMCell instance.

Register self’s status to the model’s status state status.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.