MCPcopy Create free account
hub / github.com/ARM-software/armnn / VisitResizeOperator

Function VisitResizeOperator

delegate/opaque/src/Resize.hpp:33–220  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31}
32
33TfLiteStatus 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

Callers 1

VisitNodeMethod · 0.70

Calls 12

AddResizeLayerMethod · 0.80
GetOutputSlotMethod · 0.80
ValidateNumInputsFunction · 0.70
ValidateNumOutputsFunction · 0.70
IsDynamicTensorFunction · 0.70
ValidateResizeOperatorFunction · 0.70
ProcessInputsFunction · 0.70
ConnectFunction · 0.70
to_stringFunction · 0.50
c_strMethod · 0.45
SetTensorInfoMethod · 0.45

Tested by

no test coverage detected