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

Function VisitResizeOperator

delegate/classic/src/Resize.hpp:44–201  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42}
43
44TfLiteStatus 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

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