| 42 | } |
| 43 | |
| 44 | TfLiteStatus VisitResizeOperator(DelegateData& delegateData, |
| 45 | TfLiteContext* tfLiteContext, |
| 46 | TfLiteNode* tfLiteNode, |
| 47 | int nodeIndex, |
| 48 | int32_t resizeOperatorCode) |
| 49 | { |
| 50 | TF_LITE_ENSURE_STATUS(ValidateNumInputs(tfLiteContext, tfLiteNode, 2, nodeIndex)); |
| 51 | TF_LITE_ENSURE_STATUS(ValidateNumOutputs(tfLiteContext, tfLiteNode, 1, nodeIndex)); |
| 52 | |
| 53 | const TfLiteTensor* tfLiteTensors = tfLiteContext->tensors; |
| 54 | |
| 55 | // The first input contains the data of the image that should be resized [batch, height, width, channels] |
| 56 | const TfLiteTensor& tfLiteInputTensor = tfLiteTensors[tfLiteNode->inputs->data[0]]; |
| 57 | if (IsDynamicTensor(tfLiteInputTensor)) |
| 58 | { |
| 59 | TF_LITE_MAYBE_KERNEL_LOG( |
| 60 | tfLiteContext, |
| 61 | "TfLiteArmnnDelegate: Dynamic input tensors are not supported in operator #%d node #%d: ", |
| 62 | resizeOperatorCode, nodeIndex); |
| 63 | return kTfLiteError; |
| 64 | } |
| 65 | |
| 66 | // The second input contains a size tensor. The size tensor contains two integer values |
| 67 | // that describe the new height and width of the image [new_height, new_width] |
| 68 | const TfLiteTensor& tfLiteSizeTensor = tfLiteTensors[tfLiteNode->inputs->data[1]]; |
| 69 | if (IsDynamicTensor(tfLiteSizeTensor)) |
| 70 | { |
| 71 | TF_LITE_MAYBE_KERNEL_LOG( |
| 72 | tfLiteContext, |
| 73 | "TfLiteArmnnDelegate: Dynamic input tensors are not supported in operator #%d node #%d: ", |
| 74 | resizeOperatorCode, nodeIndex); |
| 75 | return kTfLiteError; |
| 76 | } |
| 77 | |
| 78 | // The output tensor should have the shape [batch, new_height, new_width, channels] |
| 79 | const TfLiteTensor& tfLiteOutputTensor = tfLiteTensors[tfLiteNode->outputs->data[0]]; |
| 80 | if (IsDynamicTensor(tfLiteOutputTensor)) |
| 81 | { |
| 82 | TF_LITE_MAYBE_KERNEL_LOG( |
| 83 | tfLiteContext, |
| 84 | "TfLiteArmnnDelegate: Dynamic output tensors are not supported in operator #%d node #%d: ", |
| 85 | resizeOperatorCode, nodeIndex); |
| 86 | return kTfLiteError; |
| 87 | } |
| 88 | |
| 89 | const armnn::TensorInfo& inputTensorInfo = GetTensorInfoForTfLiteTensor(tfLiteInputTensor); |
| 90 | const armnn::TensorInfo& outputTensorInfo = GetTensorInfoForTfLiteTensor(tfLiteOutputTensor, true); |
| 91 | |
| 92 | std::string layerName("Resize"); |
| 93 | |
| 94 | // Fill descriptor |
| 95 | armnn::ResizeDescriptor desc; |
| 96 | switch (resizeOperatorCode) |
| 97 | { |
| 98 | case kTfLiteBuiltinResizeBilinear: |
| 99 | { |
| 100 | desc.m_Method = armnn::ResizeMethod::Bilinear; |
| 101 |
no test coverage detected