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

Function VisitSplitVOperator

delegate/opaque/src/Split.hpp:211–455  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

209}
210
211TfLiteStatus VisitSplitVOperator(DelegateData& delegateData,
212 TfLiteOpaqueContext* tfLiteContext,
213 TfLiteOpaqueNode* tfLiteNode,
214 int nodeIndex,
215 int32_t tfLiteSplitVOperatorCode)
216{
217
218 TF_LITE_ENSURE_STATUS(ValidateNumInputs(tfLiteContext, tfLiteNode, 3, nodeIndex));
219
220 const int* inputTensors;
221 auto numInputs = TfLiteOpaqueNodeNumberOfInputs(tfLiteNode);
222 if (TfLiteOpaqueNodeInputs(tfLiteNode, &inputTensors, &numInputs) != kTfLiteOk)
223 {
224 TF_LITE_OPAQUE_MAYBE_KERNEL_LOG(
225 tfLiteContext,
226 "TfLiteArmnnOpaqueDelegate: Unable to gather input tensor indices from node #%d: ",
227 nodeIndex);
228 return kTfLiteError;
229 }
230
231 const TfLiteOpaqueTensor* tfLiteInputTensor = TfLiteOpaqueContextGetOpaqueTensor(tfLiteContext, inputTensors[0]);
232 if (!IsValid(tfLiteContext, tfLiteInputTensor, tfLiteSplitVOperatorCode, nodeIndex))
233 {
234 return kTfLiteError;
235 }
236
237 const TfLiteOpaqueTensor* tfLiteSplitsTensor = TfLiteOpaqueContextGetOpaqueTensor(tfLiteContext, inputTensors[1]);
238 if (!IsValid(tfLiteContext, tfLiteSplitsTensor, tfLiteSplitVOperatorCode, nodeIndex))
239 {
240 return kTfLiteError;
241 }
242
243 const TfLiteOpaqueTensor* tfLiteAxisTensor = TfLiteOpaqueContextGetOpaqueTensor(tfLiteContext, inputTensors[2]);
244 if (!IsValid(tfLiteContext, tfLiteAxisTensor, tfLiteSplitVOperatorCode, nodeIndex))
245 {
246 return kTfLiteError;
247 }
248
249 const armnn::TensorInfo& inputTensorInfo = GetTensorInfoForTfLiteOpaqueTensor(tfLiteInputTensor);
250 const armnn::TensorInfo& splitsTensorInfo = GetTensorInfoForTfLiteOpaqueTensor(tfLiteSplitsTensor);
251
252 if (splitsTensorInfo.GetNumDimensions() != 1)
253 {
254 return kTfLiteError;
255 }
256
257 if (GetTensorInfoForTfLiteOpaqueTensor(tfLiteAxisTensor).GetNumElements() != 1)
258 {
259 return kTfLiteError;
260 }
261
262 auto* axisTensorDataPtr = static_cast<uint32_t*>(TfLiteOpaqueTensorData(tfLiteAxisTensor));
263 std::vector<int32_t> axisTensorData(axisTensorDataPtr, axisTensorDataPtr + 1);
264 int32_t axis = axisTensorData[0];
265
266 auto inputDimensions = static_cast<int32_t>(inputTensorInfo.GetNumDimensions());
267 if (((axis < -inputDimensions) && (axis < 0)) || ((axis >= inputDimensions) && (axis > 0)))
268 {

Callers 1

VisitNodeMethod · 0.70

Calls 15

ZeroDimPresentFunction · 0.85
GetNameFunction · 0.85
push_backMethod · 0.80
SetAxisMethod · 0.80
SetViewSizeMethod · 0.80
SetViewOriginCoordMethod · 0.80
AddSplitterLayerMethod · 0.80
GetOutputSlotMethod · 0.80
ValidateNumInputsFunction · 0.70
IsValidFunction · 0.70
ValidateNumOutputsFunction · 0.70

Tested by

no test coverage detected