| 51 | |
| 52 | template <typename T> |
| 53 | inline TfLiteStatus EvalImpl(TfLiteContext* context, TfLiteNode* node, |
| 54 | T func(T), TfLiteType expected_type) { |
| 55 | const TfLiteTensor* input = GetInput(context, node, 0); |
| 56 | TfLiteTensor* output = GetOutput(context, node, 0); |
| 57 | TF_LITE_ENSURE_EQ(context, input->type, expected_type); |
| 58 | const int64_t num_elements = NumElements(input); |
| 59 | const T* in_data = GetTensorData<T>(input); |
| 60 | T* out_data = GetTensorData<T>(output); |
| 61 | for (int64_t i = 0; i < num_elements; ++i) { |
| 62 | out_data[i] = func(in_data[i]); |
| 63 | } |
| 64 | return kTfLiteOk; |
| 65 | } |
| 66 | |
| 67 | inline TfLiteStatus EvalNumeric(TfLiteContext* context, TfLiteNode* node, |
| 68 | float float_func(float)) { |
nothing calls this directly
no test coverage detected