MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / Prepare

Function Prepare

tensorflow/lite/kernels/floor_div.cc:53–89  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51}
52
53TfLiteStatus 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
91template <typename T>
92TfLiteStatus EvalImpl(TfLiteContext* context, bool requires_broadcast,

Callers

nothing calls this directly

Calls 10

NumInputsFunction · 0.85
GetInputFunction · 0.85
GetOutputFunction · 0.85
TfLiteTypeGetNameFunction · 0.85
HaveSameShapesFunction · 0.85
TfLiteIntArrayCopyFunction · 0.85
ResizeTensorMethod · 0.80
NumOutputsFunction · 0.70
ReportErrorMethod · 0.45

Tested by

no test coverage detected