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

Function VisitPooling3dOperator

delegate/opaque/src/Pooling.hpp:157–369  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

155}
156
157TfLiteStatus VisitPooling3dOperator(DelegateData& delegateData,
158 TfLiteOpaqueContext* tfLiteContext,
159 TfLiteOpaqueNode* tfLiteNode,
160 int nodeIndex,
161 std::string customOperatorName)
162{
163 TF_LITE_ENSURE_STATUS(ValidateNumInputs(tfLiteContext, tfLiteNode, 1, nodeIndex));
164 TF_LITE_ENSURE_STATUS(ValidateNumOutputs(tfLiteContext, tfLiteNode, 1, nodeIndex));
165
166 // Gather input indices and use to get input tensors.
167 int numInputs = 0;
168 const int* inputTensors;
169 if (TfLiteOpaqueNodeInputs(tfLiteNode, &inputTensors, &numInputs) != kTfLiteOk)
170 {
171 TF_LITE_OPAQUE_MAYBE_KERNEL_LOG(
172 tfLiteContext,
173 "TfLiteArmnnOpaqueDelegate: Unable to gather input tensor indices from node #%d: ",
174 nodeIndex);
175 return kTfLiteError;
176 }
177
178 const TfLiteOpaqueTensor* tfLiteInputTensor = TfLiteOpaqueContextGetOpaqueTensor(tfLiteContext, inputTensors[0]);
179 if (!IsValid(tfLiteContext, tfLiteInputTensor, kTfLiteBuiltinCustom, nodeIndex))
180 {
181 return kTfLiteError;
182 }
183
184 // Gather output indices and use to get output tensors.
185 int numOutputs = 0;
186 const int* outputTensors;
187 if (TfLiteOpaqueNodeOutputs(tfLiteNode, &outputTensors, &numOutputs) != kTfLiteOk)
188 {
189 TF_LITE_OPAQUE_MAYBE_KERNEL_LOG(
190 tfLiteContext,
191 "TfLiteArmnnOpaqueDelegate: Unable to gather output tensor indices from node #%d: ",
192 nodeIndex);
193 return kTfLiteError;
194 }
195
196 const TfLiteOpaqueTensor* tfLiteOutputTensor = TfLiteOpaqueContextGetOpaqueTensor(tfLiteContext, outputTensors[0]);
197 if (!IsValid(tfLiteContext, tfLiteOutputTensor, kTfLiteBuiltinCustom, nodeIndex))
198 {
199 return kTfLiteError;
200 }
201
202 // Set the input and output info
203 const armnn::TensorInfo& inputTensorInfo = GetTensorInfoForTfLiteOpaqueTensor(tfLiteInputTensor);
204 const armnn::TensorInfo& outputTensorInfo = GetTensorInfoForTfLiteOpaqueTensor(tfLiteOutputTensor, true);
205
206 // Custom Operators are defined by the name string associated to the operator. Use this to determine
207 // which pooling algorithm to create the armnn operator with. L2 Pooling3D is unsupported in TfLite.
208 armnn::PoolingAlgorithm poolingAlgorithm;
209 if (customOperatorName == "MaxPool3D")
210 {
211 poolingAlgorithm = armnn::PoolingAlgorithm::Max;
212 }
213 else if (customOperatorName == "AveragePool3D")
214 {

Callers 1

VisitNodeMethod · 0.70

Calls 15

GetNameFunction · 0.85
AddPooling3dLayerMethod · 0.80
GetOutputSlotMethod · 0.80
ValidateNumInputsFunction · 0.70
ValidateNumOutputsFunction · 0.70
IsValidFunction · 0.70
ProcessInputsFunction · 0.70
ConnectFunction · 0.70
FusedActivationFunction · 0.70
CalcPaddingFunction · 0.50

Tested by

no test coverage detected