Realm

oa::ml::matrix::lstm_cell

Apply one LSTM cell update to caller-supplied hidden and cell states. gates_i has shape [batch, 4 * hidden], hidden and cell have [batch, hidden], weight_hh has [4 * hidden, hidden], and an optional recurrent bias has [4 * hidden]. Returns (hidden_next, cell_next). Errors Returns an error unless all values are nonempty same-runtime F32 matrices, shapes agree, hidden size is at most 1024, or runtime recording fails.

FnRust public API

Function Documentation

pub fn lstm_cell( gates_i: &Matrix, hidden: &Matrix, cell: &Matrix, weight_hh: &Matrix, bias_hh: Option<&Matrix>, ) -> Result<( Matrix, Matrix )>
Apply one LSTM cell update to caller-supplied hidden and cell states. gates_i has shape [batch, 4 * hidden], hidden and cell have [batch, hidden], weight_hh has [4 * hidden, hidden], and an optional recurrent bias has [4 * hidden]. Returns (hidden_next, cell_next). Errors Returns an error unless all values are nonempty same-runtime F32 matrices, shapes agree, hidden size is at most 1024, or runtime recording fails.