| 31 | } |
| 32 | |
| 33 | TfLiteStatus VisitResizeOperator(DelegateData& delegateData, |
| 34 | TfLiteOpaqueContext* tfLiteContext, |
| 35 | TfLiteOpaqueNode* tfLiteNode, |
| 36 | int nodeIndex, |
| 37 | int32_t resizeOperatorCode) |
| 38 | { |
| 39 | TF_LITE_ENSURE_STATUS(ValidateNumInputs(tfLiteContext, tfLiteNode, 2, nodeIndex)); |
| 40 | TF_LITE_ENSURE_STATUS(ValidateNumOutputs(tfLiteContext, tfLiteNode, 1, nodeIndex)); |
| 41 | |
| 42 | // Gather input indices and use to get input tensor. |
| 43 | auto numInputs = TfLiteOpaqueNodeNumberOfInputs(tfLiteNode); |
| 44 | const int* inputTensors; |
| 45 | if (TfLiteOpaqueNodeInputs(tfLiteNode, &inputTensors, &numInputs) != kTfLiteOk) |
| 46 | { |
| 47 | TF_LITE_OPAQUE_MAYBE_KERNEL_LOG( |
| 48 | tfLiteContext, |
| 49 | "TfLiteArmnnOpaqueDelegate: Unable to gather input tensor indices from node #%d: ", |
| 50 | nodeIndex); |
| 51 | return kTfLiteError; |
| 52 | } |
| 53 | |
| 54 | // The first input contains the data of the image that should be resized [batch, height, width, channels] |
| 55 | const TfLiteOpaqueTensor* tfLiteInputTensor = |
| 56 | TfLiteOpaqueContextGetOpaqueTensor(tfLiteContext, inputTensors[0]); |
| 57 | if (IsDynamicTensor(tfLiteInputTensor)) |
| 58 | { |
| 59 | TF_LITE_OPAQUE_MAYBE_KERNEL_LOG( |
| 60 | tfLiteContext, |
| 61 | "TfLiteArmnnOpaqueDelegate: 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 TfLiteOpaqueTensor* tfLiteSizeTensor = |
| 69 | TfLiteOpaqueContextGetOpaqueTensor(tfLiteContext, inputTensors[1]); |
| 70 | if (IsDynamicTensor(tfLiteSizeTensor)) |
| 71 | { |
| 72 | TF_LITE_OPAQUE_MAYBE_KERNEL_LOG( |
| 73 | tfLiteContext, |
| 74 | "TfLiteArmnnOpaqueDelegate: Dynamic input tensors are not supported in operator #%d node #%d: ", |
| 75 | resizeOperatorCode, nodeIndex); |
| 76 | return kTfLiteError; |
| 77 | } |
| 78 | |
| 79 | // Gather output indices and use to get output tensors. |
| 80 | int numOutputs = 0; |
| 81 | const int* outputTensors; |
| 82 | if (TfLiteOpaqueNodeOutputs(tfLiteNode, &outputTensors, &numOutputs) != kTfLiteOk) |
| 83 | { |
| 84 | TF_LITE_OPAQUE_MAYBE_KERNEL_LOG( |
| 85 | tfLiteContext, |
| 86 | "TfLiteArmnnOpaqueDelegate: Unable to gather output tensor indices from node #%d: ", |
| 87 | nodeIndex); |
| 88 | return kTfLiteError; |
| 89 | } |
| 90 |
no test coverage detected