The LSTM Op engine.
| 751 | |
| 752 | // The LSTM Op engine. |
| 753 | TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) { |
| 754 | const auto* params = reinterpret_cast<TfLiteBidirectionalSequenceLSTMParams*>( |
| 755 | node->builtin_data); |
| 756 | |
| 757 | // Input tensor. |
| 758 | const TfLiteTensor* input = GetInput(context, node, kInputTensor); |
| 759 | |
| 760 | // Tensors for the forward cell. |
| 761 | const TfLiteTensor* fw_input_to_input_weights = |
| 762 | GetOptionalInputTensor(context, node, kFwInputToInputWeightsTensor); |
| 763 | const TfLiteTensor* fw_input_to_forget_weights = |
| 764 | GetInput(context, node, kFwInputToForgetWeightsTensor); |
| 765 | const TfLiteTensor* fw_input_to_cell_weights = |
| 766 | GetInput(context, node, kFwInputToCellWeightsTensor); |
| 767 | const TfLiteTensor* fw_input_to_output_weights = |
| 768 | GetInput(context, node, kFwInputToOutputWeightsTensor); |
| 769 | |
| 770 | const TfLiteTensor* fw_recurrent_to_input_weights = |
| 771 | GetOptionalInputTensor(context, node, kFwRecurrentToInputWeightsTensor); |
| 772 | const TfLiteTensor* fw_recurrent_to_forget_weights = |
| 773 | GetInput(context, node, kFwRecurrentToForgetWeightsTensor); |
| 774 | const TfLiteTensor* fw_recurrent_to_cell_weights = |
| 775 | GetInput(context, node, kFwRecurrentToCellWeightsTensor); |
| 776 | const TfLiteTensor* fw_recurrent_to_output_weights = |
| 777 | GetInput(context, node, kFwRecurrentToOutputWeightsTensor); |
| 778 | |
| 779 | const TfLiteTensor* fw_cell_to_input_weights = |
| 780 | GetOptionalInputTensor(context, node, kFwCellToInputWeightsTensor); |
| 781 | const TfLiteTensor* fw_cell_to_forget_weights = |
| 782 | GetOptionalInputTensor(context, node, kFwCellToForgetWeightsTensor); |
| 783 | const TfLiteTensor* fw_cell_to_output_weights = |
| 784 | GetOptionalInputTensor(context, node, kFwCellToOutputWeightsTensor); |
| 785 | |
| 786 | const TfLiteTensor* fw_input_gate_bias = |
| 787 | GetOptionalInputTensor(context, node, kFwInputGateBiasTensor); |
| 788 | const TfLiteTensor* fw_forget_gate_bias = |
| 789 | GetInput(context, node, kFwForgetGateBiasTensor); |
| 790 | const TfLiteTensor* fw_cell_bias = |
| 791 | GetInput(context, node, kFwCellGateBiasTensor); |
| 792 | const TfLiteTensor* fw_output_gate_bias = |
| 793 | GetInput(context, node, kFwOutputGateBiasTensor); |
| 794 | |
| 795 | const TfLiteTensor* fw_projection_weights = |
| 796 | GetOptionalInputTensor(context, node, kFwProjectionWeightsTensor); |
| 797 | const TfLiteTensor* fw_projection_bias = |
| 798 | GetOptionalInputTensor(context, node, kFwProjectionBiasTensor); |
| 799 | |
| 800 | TfLiteTensor* fw_activation_state = |
| 801 | GetVariableInput(context, node, kFwInputActivationStateTensor); |
| 802 | TfLiteTensor* fw_cell_state = |
| 803 | GetVariableInput(context, node, kFwInputCellStateTensor); |
| 804 | TfLiteTensor* fw_output = GetOutput(context, node, kFwOutputTensor); |
| 805 | |
| 806 | // Tensors for the backward cell. |
| 807 | const TfLiteTensor* bw_input_to_input_weights = |
| 808 | GetOptionalInputTensor(context, node, kBwInputToInputWeightsTensor); |
| 809 | const TfLiteTensor* bw_input_to_forget_weights = |
| 810 | GetInput(context, node, kBwInputToForgetWeightsTensor); |
nothing calls this directly
no test coverage detected