Class ov::op::v3::GRUCell#

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

Class for GRU cell node.

Note

Note this class represents only single cell and not whole GRU layer.

Public Functions

GRUCell(const Output<Node> &X, const Output<Node> &initial_hidden_state, const Output<Node> &W, const Output<Node> &R, std::size_t hidden_size)#

Constructs GRUCell 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: [gates_count * hidden_size, input_size].

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

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

GRUCell(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, const std::vector<float> &activations_alpha, const std::vector<float> &activations_beta, float clip, bool linear_before_reset)#

Constructs GRUCell 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: [gates_count * hidden_size, input_size].

  • R[in] The recurrence weight tensor with shape: [gates_count * 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.

GRUCell(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>{"sigmoid", "tanh"}, const std::vector<float> &activations_alpha = {}, const std::vector<float> &activations_beta = {}, float clip = 0.f, bool linear_before_reset = false)#

Constructs GRUCell 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: [gates_count * hidden_size, input_size].

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

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

  • B[in] The sum of biases (weight and recurrence) for update, reset and hidden gates. If linear_before_reset := true then biases for hidden gates are placed separately (weight and recurrence). Shape: [gates_count * hidden_size] if linear_before_reset := false Shape: [(gates_count + 1) * hidden_size] if linear_before_reset := true

  • 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.

  • linear_before_reset[in] Whether or not to apply the linear transformation before multiplying by the output of the reset gate.

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.