| 51 | } |
| 52 | |
| 53 | TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) { |
| 54 | TF_LITE_ENSURE_EQ(context, NumInputs(node), 2); |
| 55 | TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1); |
| 56 | |
| 57 | // Reinterprete the opaque data provided by user. |
| 58 | OpData* data = reinterpret_cast<OpData*>(node->user_data); |
| 59 | |
| 60 | const TfLiteTensor* input1 = GetInput(context, node, kInputTensor1); |
| 61 | const TfLiteTensor* input2 = GetInput(context, node, kInputTensor2); |
| 62 | TfLiteTensor* output = GetOutput(context, node, kOutputTensor); |
| 63 | |
| 64 | TF_LITE_ENSURE_EQ(context, input1->type, input2->type); |
| 65 | |
| 66 | const TfLiteType type = input1->type; |
| 67 | switch (type) { |
| 68 | case kTfLiteFloat32: |
| 69 | case kTfLiteInt32: |
| 70 | break; |
| 71 | default: |
| 72 | context->ReportError(context, "Type '%s' is not supported by floor_div.", |
| 73 | TfLiteTypeGetName(type)); |
| 74 | return kTfLiteError; |
| 75 | } |
| 76 | output->type = type; |
| 77 | |
| 78 | data->requires_broadcast = !HaveSameShapes(input1, input2); |
| 79 | |
| 80 | TfLiteIntArray* output_size = nullptr; |
| 81 | if (data->requires_broadcast) { |
| 82 | TF_LITE_ENSURE_OK(context, CalculateShapeForBroadcast( |
| 83 | context, input1, input2, &output_size)); |
| 84 | } else { |
| 85 | output_size = TfLiteIntArrayCopy(input1->dims); |
| 86 | } |
| 87 | |
| 88 | return context->ResizeTensor(context, output, output_size); |
| 89 | } |
| 90 | |
| 91 | template <typename T> |
| 92 | TfLiteStatus EvalImpl(TfLiteContext* context, bool requires_broadcast, |
nothing calls this directly
no test coverage detected