| 168 | } |
| 169 | |
| 170 | TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) { |
| 171 | auto* params = reinterpret_cast<TfLiteConvParams*>(node->builtin_data); |
| 172 | |
| 173 | TfLiteTensor* output = GetOutput(context, node, kOutputTensor); |
| 174 | const TfLiteTensor* input = GetInput(context, node, kInputTensor); |
| 175 | const TfLiteTensor* filter = GetInput(context, node, kFilterTensor); |
| 176 | const TfLiteTensor* bias = GetOptionalInputTensor(context, node, kBiasTensor); |
| 177 | |
| 178 | int input_width = input->dims->data[2]; |
| 179 | int input_height = input->dims->data[1]; |
| 180 | int filter_width = filter->dims->data[2]; |
| 181 | int filter_height = filter->dims->data[1]; |
| 182 | int output_width = output->dims->data[2]; |
| 183 | int output_height = output->dims->data[1]; |
| 184 | |
| 185 | OpData data; |
| 186 | TF_LITE_ENSURE_STATUS(CalculateOpData( |
| 187 | context, node, params, input_width, input_height, filter_width, |
| 188 | filter_height, output_width, output_height, input->type, &data)); |
| 189 | |
| 190 | switch (input->type) { // Already know in/out types are same. |
| 191 | case kTfLiteFloat32: |
| 192 | EvalFloat(context, node, params, &data, input, filter, bias, nullptr, |
| 193 | nullptr, output); |
| 194 | break; |
| 195 | case kTfLiteUInt8: |
| 196 | EvalQuantized(context, node, params, &data, input, filter, bias, nullptr, |
| 197 | nullptr, output); |
| 198 | break; |
| 199 | default: |
| 200 | context->ReportError(context, "Type %d not currently supported.", |
| 201 | input->type); |
| 202 | return kTfLiteError; |
| 203 | } |
| 204 | return kTfLiteOk; |
| 205 | } |
| 206 | |
| 207 | } // namespace conv |
| 208 |
nothing calls this directly
no test coverage detected