| 119 | } |
| 120 | |
| 121 | TfLiteStatus 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 | |
| 152 | TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) { |
| 153 | OpContext op_context(context, node); |
nothing calls this directly
no test coverage detected