LSTM

Description

Computes an one-layer LSTM.

 

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 the gates. Concatenation ofΒ W[iofc]Β andΒ WB[iofc]Β (if bidirectional) along dimension 0. The tensor has shapeΒ [num_directions,Β 4*hidden_size,Β input_size].
R (heterogeneous) – T : object, the recurrence weight tensor. Concatenation ofΒ R[iofc]Β andΒ RB[iofc]Β (if bidirectional) along dimension 0. This tensor has shapeΒ [num_directions,Β 4*hidden_size,Β hidden_size].
B (optional, heterogeneous) – T : object, the bias tensor for input gate. Concatenation ofΒ [Wb[iofc],Β Rb[iofc]], andΒ [WBb[iofc],Β RBb[iofc]]Β (if bidirectional) along dimension 0. This tensor has shapeΒ [num_directions,Β 8*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].
initial_cΒ (optional, heterogeneous) – T : object, optional initial value of the cell. If not specified – assumed to be 0. It has shapeΒ [num_directions,Β batch_size,Β hidden_size].
PΒ (optional, heterogeneous) – T : object, the weight tensor for peepholes. Concatenation ofΒ P[iof]Β andΒ PB[iof]Β (if bidirectional) along dimension 0. It has shapeΒ [num_directions,Β 3*hidde_size]. Optional: If not specified – assumed to be 0.

Β 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, aΒ list of 3 (or 6 if bidirectional) activation functions for input, output, forget, cell, and hidden. The activation functions must be one of the activation functions specified above. Optional: See the equations for default 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”.
input forget :Β boolean, couple the input and forget gates if true.
Default value β€œFalse”.
layout : enum, the shape format of inputs X, initial_h, initial_c and outputs Y, Y_h, Y_c. 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 = initial_c.shape = Y_c.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 = initial_c.shape = Y_c.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].
Y_c (optional, heterogeneous) – T : object, the last output value of the cell. 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