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

Function VisitMeanOperator

delegate/opaque/src/Control.hpp:177–303  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

175}
176
177TfLiteStatus VisitMeanOperator(DelegateData& delegateData,
178 TfLiteOpaqueContext* tfLiteContext,
179 TfLiteOpaqueNode* tfLiteNode,
180 int nodeIndex,
181 int32_t tfLiteMeanOperatorCode)
182{
183 TF_LITE_ENSURE_STATUS(ValidateNumInputs(tfLiteContext, tfLiteNode, 2, nodeIndex));
184 TF_LITE_ENSURE_STATUS(ValidateNumOutputs(tfLiteContext, tfLiteNode, 1, nodeIndex));
185
186 // Gather input indices and use to get input tensor.
187 int numInputs = 0;
188 const int* inputTensors;
189 if (TfLiteOpaqueNodeInputs(tfLiteNode, &inputTensors, &numInputs) != kTfLiteOk)
190 {
191 TF_LITE_OPAQUE_MAYBE_KERNEL_LOG(
192 tfLiteContext,
193 "TfLiteArmnnOpaqueDelegate: Unable to gather input tensor indices from node #%d: ",
194 nodeIndex);
195 return kTfLiteError;
196 }
197
198 const TfLiteOpaqueTensor* tfLiteInputTensor = TfLiteOpaqueContextGetOpaqueTensor(tfLiteContext, inputTensors[0]);
199 if (!IsValid(tfLiteContext, tfLiteInputTensor, tfLiteMeanOperatorCode, nodeIndex))
200 {
201 return kTfLiteError;
202 }
203
204 // Use input indices to get axis tensor.
205 const TfLiteOpaqueTensor* tfLiteAxisTensor = TfLiteOpaqueContextGetOpaqueTensor(tfLiteContext, inputTensors[1]);
206 if (!IsValid(tfLiteContext, tfLiteAxisTensor, tfLiteMeanOperatorCode, nodeIndex))
207 {
208 return kTfLiteError;
209 }
210
211 // Gather output indices and use to get output tensors.
212 int numOutputs = 0;
213 const int* outputTensors;
214 if (TfLiteOpaqueNodeOutputs(tfLiteNode, &outputTensors, &numOutputs) != kTfLiteOk)
215 {
216 TF_LITE_OPAQUE_MAYBE_KERNEL_LOG(
217 tfLiteContext,
218 "TfLiteArmnnOpaqueDelegate: Unable to gather output tensor indices from node #%d: ",
219 nodeIndex);
220 return kTfLiteError;
221 }
222
223 const TfLiteOpaqueTensor* tfLiteOutputTensor = TfLiteOpaqueContextGetOpaqueTensor(tfLiteContext, outputTensors[0]);
224 if (!IsValid(tfLiteContext, tfLiteOutputTensor, tfLiteMeanOperatorCode, nodeIndex))
225 {
226 return kTfLiteError;
227 }
228
229 const armnn::TensorInfo& inputTensorInfo = GetTensorInfoForTfLiteOpaqueTensor(tfLiteInputTensor);
230 const armnn::TensorInfo& axisTensorInfo = GetTensorInfoForTfLiteOpaqueTensor(tfLiteAxisTensor);
231 const armnn::TensorInfo& outputTensorInfo = GetTensorInfoForTfLiteOpaqueTensor(tfLiteOutputTensor, true);
232
233 // Check for unsupported 0-size dimensions in the tensor shapes
234 if(ZeroDimPresent({inputTensorInfo, axisTensorInfo, outputTensorInfo}))

Callers 1

VisitControlOperatorFunction · 0.70

Calls 15

ZeroDimPresentFunction · 0.85
GetNameFunction · 0.85
AddMeanLayerMethod · 0.80
GetOutputSlotMethod · 0.80
ValidateNumInputsFunction · 0.70
ValidateNumOutputsFunction · 0.70
IsValidFunction · 0.70
ProcessInputsFunction · 0.70
ConnectFunction · 0.70
GetNumElementsMethod · 0.45
GetNumDimensionsMethod · 0.45

Tested by

no test coverage detected