RNN

Description

Computes an one-layer simple RNN.

 

Input parameters

 

specified_outputs_name :Β array, this parameter lets you manually assign custom names to the output tensors of a node.

Β Graphs in :Β cluster, ONNX model architecture.

X (heterogeneous) – T : object, the input sequences packed (and potentially padded) into one 3-D tensor with the shape ofΒ [seq_length,Β batch_size,Β input_size].
W (heterogeneous) – T : object, the weight tensor for input gate. Concatenation ofΒ WiΒ andΒ WBiΒ (if bidirectional). The tensor has shapeΒ [num_directions,Β hidden_size,Β input_size].
R (heterogeneous) – T : object, the recurrence weight tensor. Concatenation ofΒ RiΒ andΒ RBiΒ (if bidirectional). The tensor has shapeΒ [num_directions,Β hidden_size,Β hidden_size].
B (optional, heterogeneous) – T : object, the bias tensor for input gate. Concatenation ofΒ [Wbi,Β Rbi]Β andΒ [WBbi,Β RBbi]Β (if bidirectional). The tensor has shapeΒ [num_directions,Β 2*hidden_size]. Optional: If not specified – assumed to be 0.
sequence lens (optional, heterogeneous) – T1 : optional tensor specifying lengths of the sequences in a batch. If not specified – assumed all sequences in the batch to have lengthΒ seq_length. It has shapeΒ [batch_size].
initial_h (optional, heterogeneous) – T : object, optional initial value of the hidden. If not specified – assumed to be 0. It has shapeΒ [num_directions,Β batch_size,Β hidden_size].

Β Parameters :Β cluster,

activation alphaΒ :Β array, optional scaling values used by some activation functions. The values are consumed in the order of activation functions, for example (f, g, h) in LSTM. Default values are the same as of corresponding ONNX operators.For example with LeakyRelu, the default alpha is 0.01.
Default value β€œempty”.
activation beta :Β array, optional scaling values used by some activation functions. The values are consumed in the order of activation functions, for example (f, g, h) in LSTM. Default values are the same as of corresponding ONNX operators.
Default value β€œempty”.
activationsΒ : array, one (or two if bidirectional) activation function for input gate. The activation function must be one of the activation functions specified above. Optional: DefaultΒ TanhΒ if not specified.
Default value β€œempty”.
clipΒ :Β float, cell clip threshold. Clipping bounds the elements of a tensor in the range of [-threshold, +threshold] and is applied to the input of activations. No clip if not specified.
Default value β€œ0”.
directionΒ : enum, specify if the RNN is forward, reverse, or bidirectional. Must be one of forward (default), reverse, or bidirectional.
Default value β€œforward”.
hidden sizeΒ : integer, number of neurons in the hidden layer.
Default value β€œ0”.
layout : enum, the shape format of inputs X, initial_h and outputs Y, Y_h. If 0, the following shapes are expected: X.shape = [seq_length, batch_size, input_size], Y.shape = [seq_length, num_directions, batch_size, hidden_size], initial_h.shape = Y_h.shape = [num_directions, batch_size, hidden_size]. If 1, the following shapes are expected: X.shape = [batch_size, seq_length, input_size], Y.shape = [batch_size, seq_length, num_directions, hidden_size], initial_h.shape = Y_h.shape = [batch_size, num_directions, hidden_size].
Default value β€œseq_length, batch_size, input_size”.
Β training?Β :Β boolean, whether the layer is in training mode (can store data for backward).
Default value β€œTrue”.
Β lda coeff :Β float, defines the coefficient by which the loss derivative will be multiplied before being sent to the previous layer (since during the backward run we go backwards).
Default value β€œ1”.

Β name (optional) :Β string,Β name of the node.

Output parameters

Β Graphs out :Β cluster, ONNX model architecture.

Y (optional, heterogeneous) – T : object, aΒ tensor that concats all the intermediate output values of the hidden. It has shapeΒ [seq_length,Β num_directions,Β batch_size,Β hidden_size].
Y_h (optional, heterogeneous) – T : object, the last output value of the hidden. It has shapeΒ [num_directions,Β batch_size,Β hidden_size].

Type Constraints

T in (tensor(double),Β tensor(float),Β tensor(float16)) : Constrain input and output types to float tensors.

T1 in (tensor(int32)) : Constrain seq_lens to integer tensor.

Example

All these exemples are snippets PNG, you can drop these Snippet onto the block diagram and get the depicted code added to your VI (Do not forget to install Deep Learning library to run it).
Table of Contents