19 "ConvertSplitToTosaOperator: Split must have only one input" );
22 "ConvertSplitToTosaOperator: Split must have at least one output" );
24 if (!inputs[0]->GetShape().AreAllDimensionsSpecified())
26 throw armnn::Exception(
"ConvertSplitToTosaOperator: Dynamic input dimensions are unsupported.");
29 std::string inputName = std::string(
"input0_");
30 std::vector<std::string> outputNames;
33 unsigned int numSplit = splitDescriptor->
GetNumViews();
42 for (
unsigned int i=0; i < numSplit; ++i)
46 outputNames.push_back(outputName);
51 for (
unsigned int i=0; i < numSplit; ++i)
54 std::string outputName =
"output" + std::to_string(i) +
"_";
55 outputNames.push_back(outputName);
61 std::vector<int32_t> beginVals;
62 beginVals.reserve(inputs[0]->GetNumDimensions());
63 std::vector<int32_t> sizeVals;
64 sizeVals.reserve(inputs[0]->GetNumDimensions());
65 for (
unsigned int j = 0; j < inputs[0]->GetNumDimensions(); ++j)
67 beginVals.emplace_back(0);
68 uint32_t dim = inputs[0]->GetShape()[j];
69 sizeVals.emplace_back(dim);
72 uint32_t axis =
static_cast<uint32_t
>(splitDescriptor->
GetAxis());
73 sizeVals[axis] = sizeVals[axis] /
static_cast<int32_t
>(numSplit);
75 std::vector<TosaSerializationOperator*> ops;
76 for (
unsigned int i=0; i < numSplit; ++i)
78 beginVals[axis] =
static_cast<int>(i) * sizeVals[axis];
79 TosaSliceAttribute attribute(beginVals, sizeVals);
80 auto* op =
new TosaSerializationOperator(Op_SLICE,
81 Attribute_SliceAttribute,
89 std::vector<TosaSerializationTensor*> tensors;
93 if(inputName.find(
"input0_") != std::string::npos)
96 DType inputDType =
ArmNNToDType(inputs[0]->GetDataType());
98 tensors.push_back(
new TosaSerializationTensor(inputName, inputShape, inputDType, {}));
102 DType outputDType =
ArmNNToDType(outputs[0]->GetDataType());
104 for (
unsigned int i=0; i < numSplit; ++i)
106 tensors.push_back(
new TosaSerializationTensor(outputNames[i], outputShape, outputDType, {}));
110 return new TosaSerializationBasicBlock(blockName,