| 1558 | } |
| 1559 | |
| 1560 | TfLiteStatus EvalQuantized( |
| 1561 | const TfLiteTensor* input, const TfLiteTensor* input_to_input_weights, |
| 1562 | const TfLiteTensor* input_to_forget_weights, |
| 1563 | const TfLiteTensor* input_to_cell_weights, |
| 1564 | const TfLiteTensor* input_to_output_weights, |
| 1565 | const TfLiteTensor* recurrent_to_input_weights, |
| 1566 | const TfLiteTensor* recurrent_to_forget_weights, |
| 1567 | const TfLiteTensor* recurrent_to_cell_weights, |
| 1568 | const TfLiteTensor* recurrent_to_output_weights, |
| 1569 | const TfLiteTensor* cell_to_input_weights, |
| 1570 | const TfLiteTensor* cell_to_forget_weights, |
| 1571 | const TfLiteTensor* cell_to_output_weights, |
| 1572 | const TfLiteTensor* input_layer_norm_coefficients, |
| 1573 | const TfLiteTensor* forget_layer_norm_coefficients, |
| 1574 | const TfLiteTensor* cell_layer_norm_coefficients, |
| 1575 | const TfLiteTensor* output_layer_norm_coefficients, |
| 1576 | const TfLiteTensor* input_gate_bias, const TfLiteTensor* forget_gate_bias, |
| 1577 | const TfLiteTensor* cell_bias, const TfLiteTensor* output_gate_bias, |
| 1578 | const TfLiteTensor* projection_weights, const TfLiteTensor* projection_bias, |
| 1579 | const TfLiteLSTMParams* params, |
| 1580 | const lstm_eval::QuantizedLstmParameter* quantized_lstm_param, |
| 1581 | TfLiteTensor* activation_state, TfLiteTensor* cell_state, |
| 1582 | TfLiteTensor* output, TfLiteTensor* scratch0, TfLiteTensor* scratch1, |
| 1583 | TfLiteTensor* scratch2, TfLiteTensor* scratch3, TfLiteTensor* scratch4) { |
| 1584 | TF_LITE_ASSERT(input->dims->size >= 2 && input->dims->size <= 3); |
| 1585 | const int n_input = input->dims->data[input->dims->size - 1]; |
| 1586 | int max_time, n_batch; |
| 1587 | if (input->dims->size == 2) { |
| 1588 | max_time = 1; |
| 1589 | n_batch = input->dims->data[0]; |
| 1590 | } else { |
| 1591 | max_time = input->dims->data[0]; |
| 1592 | n_batch = input->dims->data[1]; |
| 1593 | } |
| 1594 | |
| 1595 | // n_cell and n_output will be the same size when there is no projection. |
| 1596 | const int n_cell = input_to_output_weights->dims->data[0]; |
| 1597 | const int n_output = recurrent_to_output_weights->dims->data[1]; |
| 1598 | |
| 1599 | // Since we have already checked that weights are all there or none, we can |
| 1600 | // check the existence of only one to get the condition. |
| 1601 | const bool use_cifg = (input_to_input_weights == nullptr); |
| 1602 | const bool use_peephole = (cell_to_output_weights != nullptr); |
| 1603 | const bool is_layer_norm_lstm = (forget_layer_norm_coefficients != nullptr); |
| 1604 | const bool use_projection = (projection_weights != nullptr); |
| 1605 | |
| 1606 | // Weights and states. |
| 1607 | int8_t* input_to_input_weight_ptr = nullptr; |
| 1608 | int8_t* recurrent_to_input_weight_ptr = nullptr; |
| 1609 | int8_t* cell_to_input_weight_ptr = nullptr; |
| 1610 | int8_t* input_to_forget_weight_ptr = nullptr; |
| 1611 | int8_t* recurrent_to_forget_weight_ptr = nullptr; |
| 1612 | int8_t* cell_to_forget_weight_ptr = nullptr; |
| 1613 | int8_t* input_to_cell_weight_ptr = nullptr; |
| 1614 | int8_t* recurrent_to_cell_weight_ptr = nullptr; |
| 1615 | int8_t* input_to_output_weight_ptr = nullptr; |
| 1616 | int8_t* recurrent_to_output_weight_ptr = nullptr; |
| 1617 | int8_t* cell_to_output_weight_ptr = nullptr; |
nothing calls this directly
no test coverage detected