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

Function Prepare

tensorflow/lite/kernels/where.cc:53–78  ·  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), 1);
55 TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1);
56
57 const TfLiteTensor* cond_tensor =
58 GetInput(context, node, kInputConditionTensor);
59 TfLiteTensor* output = GetOutput(context, node, kOutputTensor);
60
61 if (cond_tensor->type != kTfLiteBool) {
62 context->ReportError(context,
63 "Condition tensor must be of type bool, but saw '%s'.",
64 TfLiteTypeGetName(cond_tensor->type));
65 return kTfLiteError;
66 }
67
68 // As output will be a 2D tensor of indices, we use int32 as data type.
69 output->type = kTfLiteInt32;
70
71 // Exit early if cond is a non-const tensor. Set output tensor to dynamic so
72 // output size can be determined in Eval.
73 if (!IsConstantTensor(cond_tensor)) {
74 SetTensorToDynamic(output);
75 return kTfLiteOk;
76 }
77 return ResizeOutputTensor(context, cond_tensor, output);
78}
79
80TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
81 const TfLiteTensor* cond_tensor =

Callers

nothing calls this directly

Calls 9

NumInputsFunction · 0.85
GetInputFunction · 0.85
GetOutputFunction · 0.85
TfLiteTypeGetNameFunction · 0.85
SetTensorToDynamicFunction · 0.85
NumOutputsFunction · 0.70
IsConstantTensorFunction · 0.70
ResizeOutputTensorFunction · 0.70
ReportErrorMethod · 0.45

Tested by

no test coverage detected