| 173 | } |
| 174 | |
| 175 | TfLiteStatus VisitSplitVOperator(DelegateData& delegateData, |
| 176 | TfLiteContext* tfLiteContext, |
| 177 | TfLiteNode* tfLiteNode, |
| 178 | int nodeIndex, |
| 179 | int32_t tfLiteSplitVOperatorCode) |
| 180 | { |
| 181 | TF_LITE_ENSURE_STATUS(ValidateNumInputs(tfLiteContext, tfLiteNode, 3, nodeIndex)); |
| 182 | |
| 183 | const TfLiteTensor* tfLiteTensors = tfLiteContext->tensors; |
| 184 | const TfLiteTensor& tfLiteInputTensor = tfLiteTensors[tfLiteNode->inputs->data[0]]; |
| 185 | if (!IsValid(tfLiteContext, tfLiteInputTensor, tfLiteSplitVOperatorCode, nodeIndex)) |
| 186 | { |
| 187 | return kTfLiteError; |
| 188 | } |
| 189 | |
| 190 | const TfLiteTensor& tfLiteSplitsTensor = tfLiteTensors[tfLiteNode->inputs->data[1]]; |
| 191 | if (!IsValid(tfLiteContext, tfLiteSplitsTensor, tfLiteSplitVOperatorCode, nodeIndex)) |
| 192 | { |
| 193 | return kTfLiteError; |
| 194 | } |
| 195 | |
| 196 | const TfLiteTensor& tfLiteAxisTensor = tfLiteTensors[tfLiteNode->inputs->data[2]]; |
| 197 | if (!IsValid(tfLiteContext, tfLiteAxisTensor, tfLiteSplitVOperatorCode, nodeIndex)) |
| 198 | { |
| 199 | return kTfLiteError; |
| 200 | } |
| 201 | |
| 202 | const armnn::TensorInfo& inputTensorInfo = GetTensorInfoForTfLiteTensor(tfLiteInputTensor); |
| 203 | const armnn::TensorInfo& splitsTensorInfo = GetTensorInfoForTfLiteTensor(tfLiteSplitsTensor); |
| 204 | |
| 205 | if (splitsTensorInfo.GetNumDimensions() != 1) |
| 206 | { |
| 207 | return kTfLiteError; |
| 208 | } |
| 209 | |
| 210 | if (GetTensorInfoForTfLiteTensor(tfLiteAxisTensor).GetNumElements() != 1) |
| 211 | { |
| 212 | return kTfLiteError; |
| 213 | } |
| 214 | |
| 215 | auto* axisTensorDataPtr = tflite::GetTensorData<int32_t>(&tfLiteAxisTensor); |
| 216 | std::vector<int32_t> axisTensorData(axisTensorDataPtr, axisTensorDataPtr + 1); |
| 217 | int32_t axis = axisTensorData[0]; |
| 218 | |
| 219 | auto inputDimensions = static_cast<int32_t>(inputTensorInfo.GetNumDimensions()); |
| 220 | if (((axis < -inputDimensions) && (axis < 0)) || ((axis >= inputDimensions) && (axis > 0))) |
| 221 | { |
| 222 | TF_LITE_MAYBE_KERNEL_LOG( |
| 223 | tfLiteContext, |
| 224 | "TfLiteArmnnDelegate: Operation has invalid axis: #%d. Axis must be in range [-n, n) in node #%d:", |
| 225 | axis, nodeIndex); |
| 226 | } |
| 227 | const unsigned int splitDim = ComputeWrappedIndex(axisTensorData[0], inputTensorInfo.GetNumDimensions()); |
| 228 | |
| 229 | auto* splitVParameters = reinterpret_cast<TfLiteSplitVParams*>(tfLiteNode->builtin_data); |
| 230 | unsigned int numSplits = 0; |
| 231 | if (splitVParameters) |
| 232 | { |
no test coverage detected