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

Function Prepare

tensorflow/lite/kernels/reshape.cc:117–135  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

115}
116
117TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
118 TF_LITE_ENSURE(context, NumInputs(node) == 1 || NumInputs(node) == 2);
119 TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1);
120
121 // Always postpone sizing string tensors, even if we could in principle
122 // calculate their shapes now. String tensors don't benefit from having their
123 // shapes precalculated because the actual memory can only be allocated after
124 // we know all the content.
125 TfLiteTensor* output = GetOutput(context, node, kOutputTensor);
126 if (output->type != kTfLiteString) {
127 if (NumInputs(node) == 1 ||
128 IsConstantTensor(GetInput(context, node, kShapeTensor))) {
129 TF_LITE_ENSURE_OK(context, ResizeOutput(context, node));
130 } else {
131 SetTensorToDynamic(output);
132 }
133 }
134 return kTfLiteOk;
135}
136
137TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
138 const TfLiteTensor* input = GetInput(context, node, kInputTensor);

Callers

nothing calls this directly

Calls 7

NumInputsFunction · 0.85
GetOutputFunction · 0.85
GetInputFunction · 0.85
SetTensorToDynamicFunction · 0.85
NumOutputsFunction · 0.70
IsConstantTensorFunction · 0.70
ResizeOutputFunction · 0.70

Tested by

no test coverage detected