std1.0.0-beta-7 SafeC docs

std :: ml::rnn

Struct std::LSTMCell

#include <std/ml/rnn.h> source

struct LSTMCell {
    &FloatTensor W_ii;
    &FloatTensor W_hi;
    &FloatTensor b_ii;
    &FloatTensor b_hi;
    &FloatTensor W_if;
    &FloatTensor W_hf;
    &FloatTensor b_if;
    &FloatTensor b_hf;
    &FloatTensor W_ig;
    &FloatTensor W_hg;
    &FloatTensor b_ig;
    &FloatTensor b_hg;
    &FloatTensor W_io;
    &FloatTensor W_ho;
    &FloatTensor b_io;
    &FloatTensor b_ho;
}

i_t = sigmoid(x_t@W_ii + h@W_hi + b_ii + b_hi) input gate f_t = sigmoid(x_t@W_if + h@W_hf + b_if + b_hf) forget gate g_t = tanh(x_t@W_ig + h@W_hg + b_ig + b_hg) cell candidate o_t = sigmoid(x_t@W_io + h@W_ho + b_io + b_ho) output gate c_t = f_t * c_{t-1} + i_t * g_t h_t = o_t * tanh(c_t)

Fields

Methods

§&FloatTensor forward( const &FloatTensor x_t, const &FloatTensor h_prev, const &FloatTensor c_prev, &&FloatTensor c_out, ) constsource · definition

Writes the new hidden state's tensor as the return value; '*c_out' receives the new cell state (caller-owned, like the return value).

§void collect_params(&Vec<&FloatTensor> out) constsource · definition

Parameterized (module.h): every weight tensor.

§void collect_state(&Vec<&FloatTensor> out) constsource · definition
§void drop()source · definition
§void free() consumesource · definition

= drop()

§static struct LSTMCell new(unsigned long inputSize, unsigned long hiddenSize)source · definition