| 133 | } |
| 134 | |
| 135 | TfLiteStatus EvalFloat(const TfLiteTensor* input, |
| 136 | const TfLiteTensor* input_weights, |
| 137 | const TfLiteTensor* recurrent_weights, |
| 138 | const TfLiteTensor* bias, const TfLiteRNNParams* params, |
| 139 | TfLiteTensor* hidden_state, TfLiteTensor* output) { |
| 140 | const int batch_size = input->dims->data[0]; |
| 141 | const int num_units = input_weights->dims->data[0]; |
| 142 | const int input_size = input->dims->data[1]; |
| 143 | const int output_batch_leading_dim = |
| 144 | output->dims->data[output->dims->size - 1]; |
| 145 | |
| 146 | // Initialize the pointer to hidden state. |
| 147 | float* hidden_state_ptr_batch = hidden_state->data.f; |
| 148 | // Initialize the pointer to input and output. |
| 149 | const float* input_ptr_batch = input->data.f; |
| 150 | float* output_ptr_batch = output->data.f; |
| 151 | // Initialize input_weights, recurrent_weights and bias. |
| 152 | const float* input_weights_ptr = input_weights->data.f; |
| 153 | const float* recurrent_weights_ptr = recurrent_weights->data.f; |
| 154 | const float* bias_ptr = bias->data.f; |
| 155 | |
| 156 | kernel_utils::RnnBatchStep( |
| 157 | input_ptr_batch, input_weights_ptr, recurrent_weights_ptr, bias_ptr, |
| 158 | input_size, num_units, batch_size, output_batch_leading_dim, |
| 159 | params->activation, hidden_state_ptr_batch, output_ptr_batch); |
| 160 | return kTfLiteOk; |
| 161 | } |
| 162 | |
| 163 | TfLiteStatus EvalHybrid(const TfLiteTensor* input, |
| 164 | const TfLiteTensor* input_weights, |