ScopeDynamicLSTMPass
Description
Fuses small operators within the scope generated by tf.nn.dynamic_rnn or tf.nn.bidirectional_dynamic_rnn into a DynamicLSTM operator. Currently, only the loop scenario where the cell result is BasicLSTMCell is supported, and only some shapes are supported.
Scope Details
The scope structure corresponding to dynamic_rnn is as follows.

Alternatively, the two dynamic_rnn values in bidirectional_dynamic_rnn are FW and BW, respectively.

Result Operator Prototype
DynamicLSTM. For details, see Operator Acceleration Library API Reference.
Fusion Mapping
When time_major is set to False:
- Input 1 of the rnn/transpose node is used as input 1 x after fusion.
- The input of the rnn/while/basic_lstm_cell/MatMul/Enter node is used as input 2 w after fusion.
- The input of the rnn/while/basic_lstm_cell/BiasAdd/Enter node is used as input 3 b after fusion.
- The output of the rnn/transpose_1 node is used as the output output_h after fusion.
When time_major is set to True:
- Input 3 of the rnn/TensorArrayUnstack/TensorArrayScatter/TensorArrayScatterV3 node is used as input 1 x after fusion.
- The input of the rnn/while/basic_lstm_cell/MatMul/Enter node is used as input 2 w after fusion.
- The input of the rnn/while/basic_lstm_cell/BiasAdd/Enter node is used as input 3 b after fusion.
- The output of the rnn/TensorArrayStack/TensorArrayGatherV3 node is used as the output output_h after fusion.
In the preceding scope example, time_major is set to True.
Applicable Network
Inference network that uses dynamic_rnn and a single BasicLSTMCell
Fusion Pattern Type
Non-general fusion pattern
Parent topic: Fusion Patterns