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

Function Prepare

tensorflow/lite/kernels/assign_variable.cc:35–52  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33constexpr int kInputValue = 1;
34
35TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
36 TF_LITE_ENSURE_EQ(context, NumInputs(node), 2);
37 // TODO(b/137042749): TFLite infrastructure (converter, delegate) doesn't
38 // fully support 0-output ops yet. Currently it works if we manually crfat
39 // a TFLite graph that contains variable ops. Note:
40 // * The TFLite Converter need to be changed to be able to produce an op
41 // with 0 output.
42 // * The delegation code need to be changed to handle 0 output ops. However
43 // everything still works fine when variable ops aren't used.
44 TF_LITE_ENSURE_EQ(context, NumOutputs(node), 0);
45
46 const TfLiteTensor* input_variable_id_tensor =
47 GetInput(context, node, kInputVariableId);
48 TF_LITE_ENSURE_EQ(context, input_variable_id_tensor->type, kTfLiteInt32);
49 TF_LITE_ENSURE_EQ(context, NumElements(input_variable_id_tensor), 1);
50
51 return kTfLiteOk;
52}
53
54TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
55 Subgraph* subgraph = reinterpret_cast<Subgraph*>(context->impl_);

Callers

nothing calls this directly

Calls 4

NumInputsFunction · 0.85
GetInputFunction · 0.85
NumOutputsFunction · 0.70
NumElementsFunction · 0.70

Tested by

no test coverage detected