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

Function Prepare

tensorflow/lite/kernels/pow.cc:48–78  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46}
47
48TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
49 TF_LITE_ENSURE_EQ(context, NumInputs(node), 2);
50 TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1);
51
52 OpData* data = reinterpret_cast<OpData*>(node->user_data);
53
54 const TfLiteTensor* input1 = GetInput(context, node, kInputTensor1);
55 const TfLiteTensor* input2 = GetInput(context, node, kInputTensor2);
56 TfLiteTensor* output = GetOutput(context, node, kOutputTensor);
57
58 TF_LITE_ENSURE_EQ(context, input1->type, input2->type);
59
60 const TfLiteType type = input1->type;
61 if (type != kTfLiteInt32 && type != kTfLiteFloat32) {
62 context->ReportError(context, "Unsupported data type %d.", type);
63 return kTfLiteError;
64 }
65 output->type = type;
66
67 data->requires_broadcast = !HaveSameShapes(input1, input2);
68
69 TfLiteIntArray* output_size = nullptr;
70 if (data->requires_broadcast) {
71 TF_LITE_ENSURE_OK(context, CalculateShapeForBroadcast(
72 context, input1, input2, &output_size));
73 } else {
74 output_size = TfLiteIntArrayCopy(input1->dims);
75 }
76
77 return context->ResizeTensor(context, output, output_size);
78}
79
80template <typename T>
81void PowImpl(const TfLiteTensor* input1, const TfLiteTensor* input2,

Callers

nothing calls this directly

Calls 9

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

Tested by

no test coverage detected