Class ov::op::v0::RNNCell#

class RNNCell : public ov::op::util::RNNCellBase#

Class for single RNN cell node.

See also

LSTMSequence, LSTMCell, GRUCell

Note

It follows notation and equations defined as in ONNX standard: onnx/onnx

Note

It calculates following equations:

        Ht = f(Xt*(Wi^T) + Ht-1*(Ri^T) + Wbi + Rbi)

        *       - Is a dot product,
        f       - is activation functions.

Note

This class represents only single cell (for current time step) and not the whole RNN Sequence layer

Public Functions

RNNCell(const Output<Node> &X, const Output<Node> &initial_hidden_state, const Output<Node> &W, const Output<Node> &R, std::size_t hidden_size, const std::vector<std::string> &activations = std::vector<std::string>{"tanh"}, const std::vector<float> &activations_alpha = {}, const std::vector<float> &activations_beta = {}, float clip = 0.f)#

Constructs RNNCell node.

Parameters:
  • X[in] The input tensor with shape: [batch_size, input_size].

  • initial_hidden_state[in] The hidden state tensor at current time step with shape: [batch_size, hidden_size].

  • W[in] The weight tensor with shape: [hidden_size, input_size].

  • R[in] The recurrence weight tensor with shape: [hidden_size, hidden_size].

  • hidden_size[in] The number of hidden units for recurrent cell.

  • activations[in] The vector of activation functions used inside recurrent cell.

  • activations_alpha[in] The vector of alpha parameters for activation functions in order respective to activation list.

  • activations_beta[in] The vector of beta parameters for activation functions in order respective to activation list.

  • clip[in] The value defining clipping range [-clip, clip] on input of activation functions.

RNNCell(const Output<Node> &X, const Output<Node> &initial_hidden_state, const Output<Node> &W, const Output<Node> &R, const Output<Node> &B, std::size_t hidden_size, const std::vector<std::string> &activations = std::vector<std::string>{"tanh"}, const std::vector<float> &activations_alpha = {}, const std::vector<float> &activations_beta = {}, float clip = 0.f)#

Constructs RNNCell node.

Parameters:
  • X[in] The input tensor with shape: [batch_size, input_size].

  • initial_hidden_state[in] The hidden state tensor at current time step with shape: [batch_size, hidden_size].

  • W[in] The weight tensor with shape: [hidden_size, input_size].

  • R[in] The recurrence weight tensor with shape: [hidden_size, hidden_size].

  • B[in] The bias tensor for input gate with shape: [hidden_size].

  • hidden_size[in] The number of hidden units for recurrent cell.

  • activations[in] The vector of activation functions used inside recurrent cell.

  • activations_alpha[in] The vector of alpha parameters for activation functions in order respective to activation list.

  • activations_beta[in] The vector of beta parameters for activation functions in order respective to activation list.

  • clip[in] The value defining clipping range [-clip, clip] on input of activation functions.

virtual void validate_and_infer_types() override#

Verifies that attributes and inputs are consistent and computes output shapes and element types. Must be implemented by concrete child classes so that it can be run any number of times.

Throws if the node is invalid.