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

Function Prepare

tensorflow/lite/kernels/floor_mod.cc:52–84  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

50}
51
52TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
53 TF_LITE_ENSURE_EQ(context, NumInputs(node), 2);
54 TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1);
55
56 // Reinterprete the opaque data provided by user.
57 OpData* data = reinterpret_cast<OpData*>(node->user_data);
58
59 const TfLiteTensor* input1 = GetInput(context, node, kInputTensor1);
60 const TfLiteTensor* input2 = GetInput(context, node, kInputTensor2);
61 TfLiteTensor* output = GetOutput(context, node, kOutputTensor);
62
63 TF_LITE_ENSURE_TYPES_EQ(context, input1->type, input2->type);
64
65 const TfLiteType type = input1->type;
66 if (type != kTfLiteInt32 && type != kTfLiteFloat32 && type != kTfLiteInt64) {
67 context->ReportError(context, "Type '%s' is not supported by floor_mod.",
68 TfLiteTypeGetName(type));
69 return kTfLiteError;
70 }
71 output->type = type;
72
73 data->requires_broadcast = !HaveSameShapes(input1, input2);
74
75 TfLiteIntArray* output_size = nullptr;
76 if (data->requires_broadcast) {
77 TF_LITE_ENSURE_OK(context, CalculateShapeForBroadcast(
78 context, input1, input2, &output_size));
79 } else {
80 output_size = TfLiteIntArrayCopy(input1->dims);
81 }
82
83 return context->ResizeTensor(context, output, output_size);
84}
85
86template <typename T>
87TfLiteStatus 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