| 208 | } |
| 209 | |
| 210 | TfLiteStatus PrepareSimple(TfLiteContext* context, TfLiteNode* node) { |
| 211 | TF_LITE_ENSURE_EQ(context, NumInputs(node), 2); |
| 212 | TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1); |
| 213 | |
| 214 | OpContext op_context(context, node); |
| 215 | TF_LITE_ENSURE_TYPES_EQ(context, op_context.axis->type, kTfLiteInt32); |
| 216 | TF_LITE_ENSURE_OK(context, InitializeTemporaries(context, node, &op_context)); |
| 217 | |
| 218 | TfLiteTensor* resolved_axis = GetTemporary(context, node, /*index=*/1); |
| 219 | // Leaves work to Eval if axis is not constant; else resizes output. |
| 220 | if (!IsConstantTensor(op_context.axis)) { |
| 221 | SetTensorToDynamic(op_context.output); |
| 222 | SetTensorToDynamic(resolved_axis); |
| 223 | return kTfLiteOk; |
| 224 | } |
| 225 | resolved_axis->allocation_type = kTfLiteArenaRw; |
| 226 | TF_LITE_ENSURE_OK(context, |
| 227 | ResizeTempAxis(context, &op_context, resolved_axis)); |
| 228 | TF_LITE_ENSURE_OK(context, ResizeOutputTensor(context, &op_context)); |
| 229 | return kTfLiteOk; |
| 230 | } |
| 231 | |
| 232 | TfLiteStatus PrepareAny(TfLiteContext* context, TfLiteNode* node) { |
| 233 | TF_LITE_ENSURE_EQ(context, NumInputs(node), 2); |
no test coverage detected