| 95 | } |
| 96 | |
| 97 | TfLiteStatus ResizeTensor(TfLiteContext* context, |
| 98 | const TfLiteTensor* shape_tensor, |
| 99 | TfLiteTensor* tensor_to_resize) { |
| 100 | // Currently only support int32 for output shape. |
| 101 | if (shape_tensor->type != kTfLiteInt32) { |
| 102 | context->ReportError(context, "Output shape is %d, not int32.", |
| 103 | shape_tensor->type); |
| 104 | return kTfLiteError; |
| 105 | } |
| 106 | |
| 107 | TfLiteIntArray* shape = TfLiteIntArrayCreate(NumElements(shape_tensor)); |
| 108 | for (int i = 0; i < shape->size; ++i) { |
| 109 | shape->data[i] = GetTensorData<int32_t>(shape_tensor)[i]; |
| 110 | } |
| 111 | |
| 112 | return context->ResizeTensor(context, tensor_to_resize, shape); |
| 113 | } |
| 114 | |
| 115 | // Allocate temporary tensors if necessary. |
| 116 | template <KernelType kernel_type> |
no test coverage detected