1 /* Copyright 2018 The TensorFlow Authors. All Rights Reserved. 2 3 Licensed under the Apache License, Version 2.0 (the "License"); 4 you may not use this file except in compliance with the License. 5 You may obtain a copy of the License at 6 7 http://www.apache.org/licenses/LICENSE-2.0 8 9 Unless required by applicable law or agreed to in writing, software 10 distributed under the License is distributed on an "AS IS" BASIS, 11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 See the License for the specific language governing permissions and 13 limitations under the License. 14 ==============================================================================*/ 15 #ifndef TENSORFLOW_LITE_KERNELS_LSTM_EVAL_H_ 16 #define TENSORFLOW_LITE_KERNELS_LSTM_EVAL_H_ 17 18 #include "tensorflow/lite/c/builtin_op_data.h" 19 #include "tensorflow/lite/c/c_api_internal.h" 20 21 namespace tflite { 22 namespace ops { 23 namespace builtin { 24 namespace lstm_eval { 25 26 TfLiteStatus EvalFloat( 27 const TfLiteTensor* input, const TfLiteTensor* input_to_input_weights, 28 const TfLiteTensor* input_to_forget_weights, 29 const TfLiteTensor* input_to_cell_weights, 30 const TfLiteTensor* input_to_output_weights, 31 const TfLiteTensor* recurrent_to_input_weights, 32 const TfLiteTensor* recurrent_to_forget_weights, 33 const TfLiteTensor* recurrent_to_cell_weights, 34 const TfLiteTensor* recurrent_to_output_weights, 35 const TfLiteTensor* cell_to_input_weights, 36 const TfLiteTensor* cell_to_forget_weights, 37 const TfLiteTensor* cell_to_output_weights, 38 const TfLiteTensor* input_layer_norm_coefficients, 39 const TfLiteTensor* forget_layer_norm_coefficients, 40 const TfLiteTensor* cell_layer_norm_coefficients, 41 const TfLiteTensor* output_layer_norm_coefficients, 42 const TfLiteTensor* aux_input, 43 const TfLiteTensor* aux_input_to_input_weights, 44 const TfLiteTensor* aux_input_to_forget_weights, 45 const TfLiteTensor* aux_input_to_cell_weights, 46 const TfLiteTensor* aux_input_to_output_weights, 47 const TfLiteTensor* input_gate_bias, const TfLiteTensor* forget_gate_bias, 48 const TfLiteTensor* cell_bias, const TfLiteTensor* output_gate_bias, 49 const TfLiteTensor* projection_weights, const TfLiteTensor* projection_bias, 50 const TfLiteLSTMParams* params, bool forward_sequence, bool time_major, 51 int output_offset, TfLiteTensor* scratch_buffer, 52 TfLiteTensor* activation_state, TfLiteTensor* cell_state, 53 TfLiteTensor* output); 54 55 TfLiteStatus EvalHybrid( 56 const TfLiteTensor* input, const TfLiteTensor* input_to_input_weights, 57 const TfLiteTensor* input_to_forget_weights, 58 const TfLiteTensor* input_to_cell_weights, 59 const TfLiteTensor* input_to_output_weights, 60 const TfLiteTensor* recurrent_to_input_weights, 61 const TfLiteTensor* recurrent_to_forget_weights, 62 const TfLiteTensor* recurrent_to_cell_weights, 63 const TfLiteTensor* recurrent_to_output_weights, 64 const TfLiteTensor* cell_to_input_weights, 65 const TfLiteTensor* cell_to_forget_weights, 66 const TfLiteTensor* cell_to_output_weights, 67 const TfLiteTensor* input_layer_norm_coefficients, 68 const TfLiteTensor* forget_layer_norm_coefficients, 69 const TfLiteTensor* cell_layer_norm_coefficients, 70 const TfLiteTensor* output_layer_norm_coefficients, 71 const TfLiteTensor* aux_input, 72 const TfLiteTensor* aux_input_to_input_weights, 73 const TfLiteTensor* aux_input_to_forget_weights, 74 const TfLiteTensor* aux_input_to_cell_weights, 75 const TfLiteTensor* aux_input_to_output_weights, 76 const TfLiteTensor* input_gate_bias, const TfLiteTensor* forget_gate_bias, 77 const TfLiteTensor* cell_bias, const TfLiteTensor* output_gate_bias, 78 const TfLiteTensor* projection_weights, const TfLiteTensor* projection_bias, 79 const TfLiteLSTMParams* params, bool forward_sequence, bool time_major, 80 int output_offset, TfLiteTensor* scratch_buffer, 81 TfLiteTensor* scaling_factors, TfLiteTensor* prod_scaling_factors, 82 TfLiteTensor* recovered_cell_weights, TfLiteTensor* input_quantized, 83 TfLiteTensor* aux_input_quantized, TfLiteTensor* output_state_quantized, 84 TfLiteTensor* cell_state_quantized, TfLiteTensor* output_state, 85 TfLiteTensor* cell_state, TfLiteTensor* output); 86 87 } // namespace lstm_eval 88 } // namespace builtin 89 } // namespace ops 90 } // namespace tflite 91 #endif // TENSORFLOW_LITE_KERNELS_LSTM_EVAL_H_ 92