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

Function Prepare

tensorflow/lite/kernels/split_v.cc:121–150  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

119}
120
121TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
122 TF_LITE_ENSURE_EQ(context, NumInputs(node), 3);
123
124 OpContext op_context(context, node);
125
126 TF_LITE_ENSURE_EQ(context, NumOutputs(node), op_context.params->num_splits);
127
128 auto input_type = op_context.input->type;
129 TF_LITE_ENSURE(context,
130 input_type == kTfLiteFloat32 || input_type == kTfLiteUInt8 ||
131 input_type == kTfLiteInt16 || input_type == kTfLiteInt32 ||
132 input_type == kTfLiteInt64);
133 for (int i = 0; i < NumOutputs(node); ++i) {
134 GetOutput(context, node, i)->type = input_type;
135 }
136
137 auto size_splits = op_context.size_splits;
138 TF_LITE_ENSURE_EQ(context, NumDimensions(size_splits), 1);
139 TF_LITE_ENSURE_EQ(context, NumOutputs(node), NumElements(size_splits));
140
141 // If we know the contents of the 'size_splits' tensor and the 'axis' tensor,
142 // resize all outputs. Otherwise, wait until Eval().
143 if (IsConstantTensor(op_context.size_splits) &&
144 IsConstantTensor(op_context.axis)) {
145 return ResizeOutputTensors(context, node, op_context.input,
146 op_context.size_splits, op_context.axis);
147 } else {
148 return UseDynamicOutputTensors(context, node);
149 }
150}
151
152TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
153 OpContext op_context(context, node);

Callers

nothing calls this directly

Calls 8

NumInputsFunction · 0.85
GetOutputFunction · 0.85
NumDimensionsFunction · 0.85
NumOutputsFunction · 0.70
NumElementsFunction · 0.70
IsConstantTensorFunction · 0.70
ResizeOutputTensorsFunction · 0.70
UseDynamicOutputTensorsFunction · 0.70

Tested by

no test coverage detected