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

Function Prepare

tensorflow/lite/kernels/squared_difference.cc:53–77  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51}
52
53TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
54 OpData* data = reinterpret_cast<OpData*>(node->user_data);
55
56 TF_LITE_ENSURE_EQ(context, NumInputs(node), 2);
57 TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1);
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_EQ(context, input1->type, input2->type);
64 output->type = input2->type;
65
66 data->requires_broadcast = !HaveSameShapes(input1, input2);
67
68 TfLiteIntArray* output_size = nullptr;
69 if (data->requires_broadcast) {
70 TF_LITE_ENSURE_OK(context, CalculateShapeForBroadcast(
71 context, input1, input2, &output_size));
72 } else {
73 output_size = TfLiteIntArrayCopy(input1->dims);
74 }
75
76 return context->ResizeTensor(context, output, output_size);
77}
78
79template <typename T>
80void EvalSquaredDifference(TfLiteContext* context, TfLiteNode* node,

Callers

nothing calls this directly

Calls 8

NumInputsFunction · 0.85
GetInputFunction · 0.85
GetOutputFunction · 0.85
HaveSameShapesFunction · 0.85
TfLiteIntArrayCopyFunction · 0.85
ResizeTensorMethod · 0.80
NumOutputsFunction · 0.70

Tested by

no test coverage detected