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

Function PrepareSimple

tensorflow/lite/kernels/reduce.cc:210–230  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

208}
209
210TfLiteStatus PrepareSimple(TfLiteContext* context, TfLiteNode* node) {
211 TF_LITE_ENSURE_EQ(context, NumInputs(node), 2);
212 TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1);
213
214 OpContext op_context(context, node);
215 TF_LITE_ENSURE_TYPES_EQ(context, op_context.axis->type, kTfLiteInt32);
216 TF_LITE_ENSURE_OK(context, InitializeTemporaries(context, node, &op_context));
217
218 TfLiteTensor* resolved_axis = GetTemporary(context, node, /*index=*/1);
219 // Leaves work to Eval if axis is not constant; else resizes output.
220 if (!IsConstantTensor(op_context.axis)) {
221 SetTensorToDynamic(op_context.output);
222 SetTensorToDynamic(resolved_axis);
223 return kTfLiteOk;
224 }
225 resolved_axis->allocation_type = kTfLiteArenaRw;
226 TF_LITE_ENSURE_OK(context,
227 ResizeTempAxis(context, &op_context, resolved_axis));
228 TF_LITE_ENSURE_OK(context, ResizeOutputTensor(context, &op_context));
229 return kTfLiteOk;
230}
231
232TfLiteStatus PrepareAny(TfLiteContext* context, TfLiteNode* node) {
233 TF_LITE_ENSURE_EQ(context, NumInputs(node), 2);

Callers 2

PrepareAnyFunction · 0.85
PrepareMeanOrSumFunction · 0.85

Calls 8

NumInputsFunction · 0.85
InitializeTemporariesFunction · 0.85
GetTemporaryFunction · 0.85
SetTensorToDynamicFunction · 0.85
ResizeTempAxisFunction · 0.85
NumOutputsFunction · 0.70
IsConstantTensorFunction · 0.70
ResizeOutputTensorFunction · 0.70

Tested by

no test coverage detected