19 using namespace armnn;
27 const std::vector<TensorInfo> & inputTensorInfos,
28 unsigned int concatDim)
30 std::vector<TensorShape> shapes;
31 shapes.reserve(inputTensorInfos.size());
34 shapes.push_back(it.GetShape());
47 const std::vector<TensorInfo> & inputTensorInfos,
48 unsigned int concatDim)
52 unsigned int nDimensions = 0;
56 for (
auto && tensorInfo : inputTensorInfos)
60 nDimensions = tensorInfo.GetShape().GetNumDimensions();
65 "Input shapes must have the same number of dimensions");
69 return (nDimensions < 3 || (nDimensions == 3 && (nDimensions-concatDim) < 3 && (nDimensions-concatDim) != 1));
81 std::vector<unsigned int> newDims(
size_t(3), 1u);
82 unsigned int expandedBy = 3 - numDims;
83 for (
unsigned int i=0; i<numDims; ++i)
85 newDims[expandedBy+i] = inputShape[i];
91 unsigned int numDimensions,
92 unsigned int & concatDim,
93 std::pair<PermutationVector, PermutationVector> & permutations)
96 "Only dimensions 1,2 and 3 are supported by this helper");
97 unsigned int expandedBy = 3 - numDimensions;
98 unsigned int expandedConcatAxis = concatDim + expandedBy;
100 if (expandedConcatAxis == 2)
105 permutations = std::make_pair(forwardPermutation, reversePermutation);
107 else if (expandedConcatAxis == 1)
112 permutations = std::make_pair(forwardPermutation, reversePermutation);
128 std::vector<T>& outputData)
132 if (inputData ==
nullptr)
141 std::unique_ptr<ITensorHandle> inputHandle = tensorHandleFactory.
CreateTensorHandle(inputTensorInfo);
142 std::unique_ptr<ITensorHandle> outputHandle = tensorHandleFactory.
CreateTensorHandle(outputTensorInfo);
147 AddInputToWorkload(queueDescriptor, workloadInfo, inputTensorInfo, inputHandle.get());
148 AddOutputToWorkload(queueDescriptor, workloadInfo, outputTensorInfo, outputHandle.get());
150 std::unique_ptr<IWorkload> workload = workloadFactory.
CreatePermute(queueDescriptor, workloadInfo);
152 inputHandle->Allocate();
153 outputHandle->Allocate();
157 workload->PostAllocationConfigure();
162 inputTensorInfo = outputTensorInfo;
175 std::vector<TensorInfo> & inputTensorInfos,
176 std::vector<T *> & inputData,
177 std::vector<std::vector<T>> & inputDataStorage,
179 unsigned int & concatDim,
184 "Expecting more than one tensor to be concatenated here");
186 unsigned int numDims = 0;
187 unsigned int nthInput = 0;
190 std::pair<PermutationVector, PermutationVector> permutations =
191 std::make_pair(identity, identity);
193 inputDataStorage.resize(inputData.size());
195 for (
auto && tensorInfo : inputTensorInfos)
199 numDims = tensorInfo.GetShape().GetNumDimensions();
203 permuteVector = permutations.second;
205 "Test logic error, we don't need permutation, so we shouldn't arrive here");
210 "All inputs must have the same number of dimensions");
216 PermuteTensorData<T>(workloadFactory,
222 inputDataStorage[nthInput]);
224 inputData[nthInput] = inputDataStorage[nthInput].data();
225 inputTensorInfos[nthInput] = newTensorInfo;
233 permutations.first));
247 std::unique_ptr<ITensorHandle> && inputDataHandle,
261 std::vector<T> outputData;
265 PermuteTensorData<T>(workloadFactory,
273 ::memcpy(data, &outputData[0],
sizeof(T)*outputData.size());
280 std::initializer_list<const TensorInfo> inputTensorInfosOrig,
281 std::initializer_list<T *> inputsOrig,
284 unsigned int concatDim,
288 if (output ==
nullptr)
297 std::vector<TensorInfo> inputTensorInfos(inputTensorInfosOrig.begin(), inputTensorInfosOrig.end());
298 std::vector<T *> inputs = inputsOrig;
299 TensorInfo outputTensorInfo = outputTensorInfoOrig;
304 std::vector<std::vector<T>> tmpInputDataStorage;
306 const size_t inputCount = inputTensorInfos.size();
310 if (needPermuteForConcat)
316 PermuteInputsForConcat<T>(workloadFactory,
329 std::vector<std::unique_ptr<ITensorHandle>> inputHandles;
330 inputHandles.reserve(inputCount);
332 std::unique_ptr<ITensorHandle> outputHandle = tensorHandleFactory.
CreateTensorHandle(outputTensorInfo);
341 for (
unsigned int i = 0; i < viewsDescriptor.
GetNumViews(); ++i)
350 for (
unsigned int i = 0; i < inputCount; ++i)
352 const TensorInfo& inputTensorInfo = inputTensorInfos[i];
354 std::unique_ptr<ITensorHandle> inputHandle =
355 subTensorsSupported ?
361 inputHandles.emplace_back(std::move(inputHandle));
368 for (
unsigned int i = 0; i < inputCount; ++i)
370 std::unique_ptr<ITensorHandle> inputHandle = tensorHandleFactory.
CreateTensorHandle(inputTensorInfos[i]);
371 inputHandles.emplace_back(std::move(inputHandle));
375 for (
unsigned int i = 0; i < inputCount; ++i)
377 AddInputToWorkload(queueDescriptor, workloadInfo, inputTensorInfos[i], inputHandles[i].
get());
380 AddOutputToWorkload(queueDescriptor, workloadInfo, outputTensorInfo, outputHandle.get());
382 std::unique_ptr<IWorkload> workload = workloadFactory.
CreateConcat(queueDescriptor, workloadInfo);
384 for (
auto& inputHandle : inputHandles)
386 inputHandle->Allocate();
389 outputHandle->Allocate();
391 unsigned int nextInputId = 0;
392 for (
auto& inputHandle : inputHandles)
398 workload->PostAllocationConfigure();
401 if (needPermuteForConcat)
403 PermuteOutputForConcat<T>(workloadFactory,
408 std::move(outputHandle),
421 template<DataType ArmnnType,
typename T = ResolveType<ArmnnType>>
429 TensorInfo inputTensorInfo({ 3 }, ArmnnType, qScale, qOffset);
431 auto input0 = MakeTensor<T, 1>(inputTensorInfo, QuantizedVector<T>({ 1.0f, 2.0f, 3.0f }, qScale, qOffset));
432 auto input1 = MakeTensor<T, 1>(inputTensorInfo, QuantizedVector<T>({ 4.0f, 5.0f, 6.0f }, qScale, qOffset));
433 auto input2 = MakeTensor<T, 1>(inputTensorInfo, QuantizedVector<T>({ 7.0f, 8.0f, 9.0f }, qScale, qOffset));
435 TensorInfo outputTensorInfo({ 9 }, ArmnnType, qScale, qOffset);
439 std::vector<T> output;
440 output.resize(outputTensorInfo.GetNumElements());
441 Concatenate<T>(workloadFactory, memoryManager, tensorHandleFactory,
442 { inputTensorInfo, inputTensorInfo, inputTensorInfo },
443 { input0.data(), input1.data(), input2.data() },
449 result.output = MakeTensor<T, 1>(outputTensorInfo, output);
450 result.outputExpected = MakeTensor<T, 1>(outputTensorInfo, QuantizedVector<T>(
452 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f
459 template<DataType ArmnnType,
typename T = ResolveType<ArmnnType>>
465 unsigned int dimension,
467 const int32_t qOffset)
469 TensorInfo inputTensorInfo({ 2, 3 }, ArmnnType, qScale, qOffset);
471 auto input0 = MakeTensor<T, 2>(inputTensorInfo, QuantizedVector<T>(
481 auto input1 = MakeTensor<T, 2>(inputTensorInfo, QuantizedVector<T>(
491 auto input2 = MakeTensor<T, 2>(inputTensorInfo, QuantizedVector<T>(
503 std::vector<T> output;
505 Concatenate<T>(workloadFactory, memoryManager, tensorHandleFactory,
506 { inputTensorInfo, inputTensorInfo, inputTensorInfo },
507 { input0.data(), input1.data(), input2.data() },
513 result.
output = MakeTensor<T, 2>(outputTensorInfo, output);
517 template<DataType ArmnnType,
typename T = ResolveType<ArmnnType>>
525 TensorInfo outputTensorInfo({ 6, 3 }, ArmnnType, qScale, qOffset);
528 workloadFactory, memoryManager, tensorHandleFactory, outputTensorInfo, 0, qScale, qOffset);
530 result.
outputExpected = MakeTensor<T, 2>(outputTensorInfo, QuantizedVector<T>(
555 template<DataType ArmnnType,
typename T = ResolveType<ArmnnType>>
563 TensorInfo outputTensorInfo({ 2, 9 }, ArmnnType, qScale, qOffset);
566 workloadFactory, memoryManager, tensorHandleFactory, outputTensorInfo, 1, qScale, qOffset);
568 result.
outputExpected = MakeTensor<T, 2>(outputTensorInfo, QuantizedVector<T>(
571 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f,
574 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 16.0f, 17.0f, 18.0f
581 template<DataType ArmnnType,
typename T = ResolveType<ArmnnType>>
589 TensorInfo input0TensorInfo({ 2, 3 }, ArmnnType, qScale, qOffset);
590 auto input0 = MakeTensor<T, 2>(input0TensorInfo, QuantizedVector<T>(
600 TensorInfo input1TensorInfo({ 3, 3 }, ArmnnType, qScale, qOffset);
601 auto input1 = MakeTensor<T, 2>(input1TensorInfo, QuantizedVector<T>(
614 TensorInfo input2TensorInfo({ 1, 3 }, ArmnnType, qScale, qOffset);
615 auto input2 = MakeTensor<T, 2>(input2TensorInfo, QuantizedVector<T>(
622 TensorInfo outputTensorInfo({ 6, 3 }, ArmnnType, qScale, qOffset);
625 std::vector<T> output;
626 output.resize(outputTensorInfo.GetNumElements());
627 Concatenate<T>(workloadFactory, memoryManager, tensorHandleFactory,
628 { input0TensorInfo, input1TensorInfo, input2TensorInfo },
629 { input0.data(), input1.data(), input2.data() },
635 result.output = MakeTensor<T, 2>(outputTensorInfo, output);
636 result.outputExpected = MakeTensor<T, 2>(outputTensorInfo, QuantizedVector<T>(
661 template<DataType ArmnnType,
typename T = ResolveType<ArmnnType>>
669 TensorInfo input0TensorInfo({ 2, 3 }, ArmnnType, qScale, qOffset);
670 auto input0 = MakeTensor<T, 2>(input0TensorInfo, QuantizedVector<T>(
680 TensorInfo input1TensorInfo({ 2, 5 }, ArmnnType, qScale, qOffset);
681 auto input1 = MakeTensor<T, 2>(input1TensorInfo, QuantizedVector<T>(
684 4.0f, 5.0f, 6.0f, 7.0f, 8.0f,
687 13.0f, 14.0f, 15.0f, 16.0f, 17.0f,
691 TensorInfo input2TensorInfo({ 2, 1 }, ArmnnType, qScale, qOffset);
692 auto input2 = MakeTensor<T, 2>(input2TensorInfo, QuantizedVector<T>(
702 TensorInfo outputTensorInfo({ 2, 9 }, ArmnnType, qScale, qOffset);
705 std::vector<T> output;
706 output.resize(outputTensorInfo.GetNumElements());
707 Concatenate<T>(workloadFactory, memoryManager, tensorHandleFactory,
708 { input0TensorInfo, input1TensorInfo, input2TensorInfo },
709 { input0.data(), input1.data(), input2.data() },
715 result.output = MakeTensor<T, 2>(outputTensorInfo, output);
716 result.outputExpected = MakeTensor<T, 2>(outputTensorInfo, QuantizedVector<T>(
719 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f,
722 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 16.0f, 17.0f, 18.0f,
729 template<DataType ArmnnType,
typename T = ResolveType<ArmnnType>>
735 unsigned int dimension,
740 TensorInfo inputTensorInfo({ 2, 3, 2 }, ArmnnType, qScale, qOffset);
742 auto input0 = MakeTensor<T, 3>(inputTensorInfo, QuantizedVector<T>(
764 auto input1 = MakeTensor<T, 3>(inputTensorInfo, QuantizedVector<T>(
786 auto input2 = MakeTensor<T, 3>(inputTensorInfo, QuantizedVector<T>(
810 std::vector<T> output;
812 Concatenate<T>(workloadFactory, memoryManager, tensorHandleFactory,
813 { inputTensorInfo, inputTensorInfo, inputTensorInfo },
814 { input0.data(), input1.data(), input2.data() },
820 result.
output = MakeTensor<T, 3>(outputTensorInfo, output);
824 template<DataType ArmnnType,
typename T = ResolveType<ArmnnType>>
832 TensorInfo outputTensorInfo({ 6, 3, 2 }, ArmnnType, qScale, qOffset);
835 workloadFactory, memoryManager, tensorHandleFactory, outputTensorInfo, 0,
true, qScale, qOffset);
837 result.
outputExpected = MakeTensor<T, 3>(outputTensorInfo, QuantizedVector<T>(
898 template<DataType ArmnnType,
typename T = ResolveType<ArmnnType>>
906 TensorInfo outputTensorInfo({ 2, 9, 2 }, ArmnnType, qScale, qOffset);
909 workloadFactory, memoryManager, tensorHandleFactory, outputTensorInfo, 1,
true, qScale, qOffset);
911 result.
outputExpected = MakeTensor<T, 3>(outputTensorInfo, QuantizedVector<T>(
972 template<DataType ArmnnType,
typename T = ResolveType<ArmnnType>>
981 TensorInfo outputTensorInfo({ 2, 3, 6 }, ArmnnType, qScale, qOffset);
984 workloadFactory, memoryManager, tensorHandleFactory, outputTensorInfo, 2, useSubtensor, qScale, qOffset);
986 result.
outputExpected = MakeTensor<T, 3>(outputTensorInfo, QuantizedVector<T>(
989 1.0f, 2.0f, 7.0f, 8.0f, 13.0f, 14.0f,
992 3.0f, 4.0f, 9.0f, 10.0f, 15.0f, 16.0f,
995 5.0f, 6.0f, 11.0f, 12.0f, 17.0f, 18.0f,
998 19.0f, 20.0f, 25.0f, 26.0f, 31.0f, 32.0f,
1001 21.0f, 22.0f, 27.0f, 28.0f, 33.0f, 34.0f,
1004 23.0f, 24.0f, 29.0f, 30.0f, 35.0f, 36.0f,
1011 template<DataType ArmnnType,
typename T = ResolveType<ArmnnType>>
1019 TensorInfo input0TensorInfo({ 2, 3, 2 }, ArmnnType);
1020 auto input0 = MakeTensor<T, 3>(input0TensorInfo, QuantizedVector<T>(
1042 TensorInfo input1TensorInfo({ 1, 3, 2 }, ArmnnType);
1043 auto input1 = MakeTensor<T, 3>(input1TensorInfo, QuantizedVector<T>(
1056 TensorInfo input2TensorInfo({ 3, 3, 2 }, ArmnnType);
1057 auto input2 = MakeTensor<T, 3>(input2TensorInfo, QuantizedVector<T>(
1088 TensorInfo outputTensorInfo({ 6, 3, 2 }, ArmnnType);
1091 std::vector<T> output;
1092 output.resize(outputTensorInfo.GetNumElements());
1093 Concatenate<T>(workloadFactory, memoryManager, tensorHandleFactory,
1094 { input0TensorInfo, input1TensorInfo, input2TensorInfo },
1095 { input0.data(), input1.data(), input2.data() },
1101 result.output = MakeTensor<T, 3>(outputTensorInfo, output);
1102 result.outputExpected = MakeTensor<T, 3>(outputTensorInfo, QuantizedVector<T>(
1163 template<DataType ArmnnType,
typename T = ResolveType<ArmnnType>>
1171 TensorInfo input0TensorInfo({ 2, 3, 2 }, ArmnnType, qScale, qOffset);
1172 auto input0 = MakeTensor<T, 3>(input0TensorInfo, QuantizedVector<T>(
1194 TensorInfo input1TensorInfo({ 2, 4, 2 }, ArmnnType, qScale, qOffset);
1195 auto input1 = MakeTensor<T, 3>(input1TensorInfo, QuantizedVector<T>(
1223 TensorInfo input2TensorInfo({ 2, 1, 2 }, ArmnnType, qScale, qOffset);
1224 auto input2 = MakeTensor<T, 3>(input2TensorInfo, QuantizedVector<T>(
1234 TensorInfo outputTensorInfo({ 2, 8, 2 }, ArmnnType, qScale, qOffset);
1237 std::vector<T> output;
1238 output.resize(outputTensorInfo.GetNumElements());
1239 Concatenate<T>(workloadFactory, memoryManager, tensorHandleFactory,
1240 { input0TensorInfo, input1TensorInfo, input2TensorInfo },
1241 { input0.data(), input1.data(), input2.data() },
1247 result.output = MakeTensor<T, 3>(outputTensorInfo, output);
1248 result.outputExpected = MakeTensor<T, 3>(outputTensorInfo, QuantizedVector<T>(
1303 template<DataType ArmnnType,
typename T = ResolveType<ArmnnType>>
1312 TensorInfo input0TensorInfo({ 2, 3, 2 }, ArmnnType, qScale, qOffset);
1313 auto input0 = MakeTensor<T, 3>(input0TensorInfo, QuantizedVector<T>(
1335 TensorInfo input1TensorInfo({ 2, 3, 1 }, ArmnnType, qScale, qOffset);
1336 auto input1 = MakeTensor<T, 3>(input1TensorInfo, QuantizedVector<T>(
1358 TensorInfo input2TensorInfo({ 2, 3, 3 }, ArmnnType, qScale, qOffset);
1359 auto input2 = MakeTensor<T, 3>(input2TensorInfo, QuantizedVector<T>(
1362 13.0f, 14.0f, 50.0f,
1365 15.0f, 16.0f, 51.0f,
1368 17.0f, 18.0f, 52.0f,
1371 31.0f, 32.0f, 53.0f,
1374 33.0f, 34.0f, 54.0f,
1377 35.0f, 36.0f, 55.0f,
1381 TensorInfo outputTensorInfo({ 2, 3, 6 }, ArmnnType, qScale, qOffset);
1384 std::vector<T> output;
1385 output.resize(outputTensorInfo.GetNumElements());
1386 Concatenate<T>(workloadFactory, memoryManager, tensorHandleFactory,
1387 { input0TensorInfo, input1TensorInfo, input2TensorInfo },
1388 { input0.data(), input1.data(), input2.data() },
1394 result.output = MakeTensor<T, 3>(outputTensorInfo, output);
1395 result.outputExpected = MakeTensor<T, 3>(outputTensorInfo, QuantizedVector<T>(
1398 1.0f, 2.0f, 7.0f, 13.0f, 14.0f, 50.0f,
1401 3.0f, 4.0f, 9.0f, 15.0f, 16.0f, 51.0f,
1404 5.0f, 6.0f, 11.0f, 17.0f, 18.0f, 52.0f,
1407 19.0f, 20.0f, 25.0f, 31.0f, 32.0f, 53.0f,
1410 21.0f, 22.0f, 27.0f, 33.0f, 34.0f, 54.0f,
1413 23.0f, 24.0f, 29.0f, 35.0f, 36.0f, 55.0f,
1420 template<DataType ArmnnType,
typename T = ResolveType<ArmnnType>>
1426 unsigned int dimension,
1431 TensorInfo inputTensorInfo({ 1, 3, 2, 2 }, ArmnnType, qScale, qOffset);
1433 auto input0 = MakeTensor<T, 4>(inputTensorInfo, QuantizedVector<T>(
1444 auto input1 = MakeTensor<T, 4>(inputTensorInfo, QuantizedVector<T>(
1455 auto input2 = MakeTensor<T, 4>(inputTensorInfo, QuantizedVector<T>(
1468 std::vector<T> output;
1471 Concatenate<T>(workloadFactory,
1473 tensorHandleFactory,
1474 {inputTensorInfo, inputTensorInfo, inputTensorInfo},
1475 {input0.data(), input1.data(), input2.data()},
1481 result.
output = MakeTensor<T, 4>(outputTensorInfo, output);
1485 template<DataType ArmnnType,
typename T = ResolveType<ArmnnType>>
1493 TensorInfo outputTensorInfo({ 3, 3, 2, 2 }, ArmnnType, qScale, qOffset);
1496 workloadFactory, memoryManager, tensorHandleFactory, outputTensorInfo, 0,
true, qScale, qOffset);
1498 result.
outputExpected = MakeTensor<T, 4>(outputTensorInfo, QuantizedVector<T>(
1526 template<DataType ArmnnType,
typename T = ResolveType<ArmnnType>>
1534 TensorInfo outputTensorInfo({ 1, 9, 2, 2 }, ArmnnType, qScale, qOffset);
1537 workloadFactory, memoryManager, tensorHandleFactory, outputTensorInfo, 1,
true, qScale, qOffset);
1539 result.
outputExpected = MakeTensor<T, 4>(outputTensorInfo, QuantizedVector<T>(
1567 template<DataType ArmnnType,
typename T = ResolveType<ArmnnType>>
1575 TensorInfo outputTensorInfo({ 1, 3, 6, 2 }, ArmnnType, qScale, qOffset);
1578 workloadFactory, memoryManager, tensorHandleFactory, outputTensorInfo, 2,
true, qScale, qOffset);
1580 result.
outputExpected = MakeTensor<T, 4>(outputTensorInfo, QuantizedVector<T>(
1608 template<DataType ArmnnType,
typename T = ResolveType<ArmnnType>>
1617 TensorInfo outputTensorInfo({ 1, 3, 2, 6 }, ArmnnType, qScale, qOffset);
1620 workloadFactory, memoryManager, tensorHandleFactory, outputTensorInfo, 3, useSubtensor, qScale, qOffset);
1622 result.
outputExpected = MakeTensor<T, 4>(outputTensorInfo, QuantizedVector<T>(
1650 template<DataType ArmnnType,
typename T = ResolveType<ArmnnType>>
1658 constexpr
unsigned int dimension = 0u;
1660 TensorInfo inputTensorInfo0({ 1, 3, 2, 2 }, ArmnnType, qScale, qOffset);
1661 auto input0 = MakeTensor<T, 4>(inputTensorInfo0, QuantizedVector<T>(
1672 TensorInfo inputTensorInfo1({ 2, 3, 2, 2 }, ArmnnType, qScale, qOffset);
1674 auto input1 = MakeTensor<T, 4>(inputTensorInfo1, QuantizedVector<T>(
1692 TensorInfo outputTensorInfo({ 3, 3, 2, 2 }, ArmnnType, qScale, qOffset);
1696 std::vector<T> output;
1697 output.resize(outputTensorInfo.GetNumElements());
1698 Concatenate<T>(workloadFactory,
1700 tensorHandleFactory,
1701 {inputTensorInfo0, inputTensorInfo1},
1702 {input0.data(), input1.data()},
1708 result.output = MakeTensor<T, 4>(outputTensorInfo, output);
1709 result.outputExpected = MakeTensor<T, 4>(outputTensorInfo, QuantizedVector<T>(
1737 template<DataType ArmnnType,
typename T = ResolveType<ArmnnType>>
1745 constexpr
unsigned int dimension = 1u;
1747 TensorInfo inputTensorInfo0({ 1, 3, 2, 2 }, ArmnnType, qScale, qOffset);
1748 auto input0 = MakeTensor<T, 4>(inputTensorInfo0, QuantizedVector<T>(
1759 TensorInfo inputTensorInfo1({ 1, 2, 2, 2 }, ArmnnType, qScale, qOffset);
1761 auto input1 = MakeTensor<T, 4>(inputTensorInfo1, QuantizedVector<T>(
1770 TensorInfo outputTensorInfo({ 1, 5, 2, 2 }, ArmnnType, qScale, qOffset);
1774 std::vector<T> output;
1775 output.resize(outputTensorInfo.GetNumElements());
1776 Concatenate<T>(workloadFactory,
1778 tensorHandleFactory,
1779 {inputTensorInfo0, inputTensorInfo1},
1780 {input0.data(), input1.data()},
1786 result.output = MakeTensor<T, 4>(outputTensorInfo, output);
1787 result.outputExpected = MakeTensor<T, 4>(outputTensorInfo, QuantizedVector<T>(
1805 template<DataType ArmnnType,
typename T = ResolveType<ArmnnType>>
1813 constexpr
unsigned int dimension = 2u;
1815 TensorInfo inputTensorInfo0({ 1, 3, 2, 2 }, ArmnnType, qScale, qOffset);
1816 auto input0 = MakeTensor<T, 4>(inputTensorInfo0, QuantizedVector<T>(
1827 TensorInfo inputTensorInfo1({ 1, 3, 3, 2 }, ArmnnType, qScale, qOffset);
1828 auto input1 = MakeTensor<T, 4>(inputTensorInfo1, QuantizedVector<T>(
1842 TensorInfo outputTensorInfo({ 1, 3, 5, 2 }, ArmnnType, qScale, qOffset);
1845 std::vector<T> output;
1846 output.resize(outputTensorInfo.GetNumElements());
1847 Concatenate<T>(workloadFactory,
1849 tensorHandleFactory,
1850 {inputTensorInfo0, inputTensorInfo1},
1851 {input0.data(), input1.data()},
1857 result.output = MakeTensor<T, 4>(outputTensorInfo, output);
1858 result.outputExpected = MakeTensor<T, 4>(outputTensorInfo, QuantizedVector<T>(
1883 template<DataType ArmnnType,
typename T = ResolveType<ArmnnType>>
1892 constexpr
unsigned int dimension = 3u;
1894 TensorInfo inputTensorInfo0({ 1, 3, 2, 2 }, ArmnnType, qScale, qOffset);
1895 auto input0 = MakeTensor<T, 4>(inputTensorInfo0, QuantizedVector<T>(
1906 TensorInfo inputTensorInfo1({ 1, 3, 2, 3 }, ArmnnType, qScale, qOffset);
1907 auto input1 = MakeTensor<T, 4>(inputTensorInfo1, QuantizedVector<T>(
1909 11.0f, 12.0f, 13.0f,
1910 14.0f, 15.0f, 16.0f,
1912 17.0f, 18.0f, 19.0f,
1913 20.0f, 21.0f, 22.0f,
1915 23.0f, 24.0f, 25.0f,
1920 TensorInfo outputTensorInfo({ 1, 3, 2, 5 }, ArmnnType, qScale, qOffset);
1924 std::vector<T> output;
1925 output.resize(outputTensorInfo.GetNumElements());
1926 Concatenate<T>(workloadFactory,
1928 tensorHandleFactory,
1929 {inputTensorInfo0, inputTensorInfo1},
1930 {input0.data(), input1.data()},
1936 result.output = MakeTensor<T, 4>(outputTensorInfo, output);
1937 result.outputExpected = MakeTensor<T, 4>(outputTensorInfo, QuantizedVector<T>(
1939 1.0f, 2.0f, 11.0f, 12.0f, 13.0f,
1940 3.0f, 4.0f, 14.0f, 15.0f, 16.0f,
1941 5.0f, 6.0f, 17.0f, 18.0f, 19.0f,
1942 7.0f, 8.0f, 20.0f, 21.0f, 22.0f,
1943 9.0f, 10.0f, 23.0f, 24.0f, 25.0f,
1944 11.0f, 12.0f, 26.0f, 27.0f, 28.0f
1951 template<DataType ArmnnType,
typename T>
1961 TensorInfo outputTensorInfo({ 3, 6, 3 }, ArmnnType);
1962 TensorInfo inputTensorInfo1({ 3, 6, 2 }, ArmnnType);
1963 TensorInfo inputTensorInfo2({ 3, 6, 1 }, ArmnnType);
1965 std::vector<TensorShape> inputTensorShapes({inputTensorInfo1.GetShape(), inputTensorInfo2.GetShape()});
1968 const float inputScale1 = 0.5f;
1969 const int32_t inputOffset1 = 5;
1971 auto input1 = MakeTensor<T, 3>(inputTensorInfo1, std::vector<T>(
1989 const float inputScale2 = 0.2f;
1990 const int32_t inputOffset2 = 10;
1992 auto input2 = MakeTensor<T, 3>(inputTensorInfo2, std::vector<T>(
2003 const float outputScale = 0.1f;
2004 const int32_t outputOffset = 20;
2008 ret.
outputExpected = MakeTensor<T, 3>(outputTensorInfo, std::vector<T>(
2032 outputTensorInfo.SetQuantizationScale(outputScale);
2033 outputTensorInfo.SetQuantizationOffset(outputOffset);
2034 inputTensorInfo1.SetQuantizationScale(inputScale1);
2035 inputTensorInfo1.SetQuantizationOffset(inputOffset1);
2036 inputTensorInfo2.SetQuantizationScale(inputScale2);
2037 inputTensorInfo2.SetQuantizationOffset(inputOffset2);
2039 std::vector<unsigned int> wOrigin1 = { 0, 0, 0 };
2042 std::vector<unsigned int> wOrigin2 = { 0, 0, 2 };
2045 std::unique_ptr<ITensorHandle> outputHandle = tensorHandleFactory.
CreateTensorHandle(outputTensorInfo);
2049 std::unique_ptr<ITensorHandle> inputHandle1 =
2050 subTensorsSupported ?
2051 tensorHandleFactory.
CreateSubTensorHandle(*outputHandle, inputTensorInfo1.GetShape(), wOrigin1.data()) :
2054 std::unique_ptr<ITensorHandle> inputHandle2 =
2055 subTensorsSupported ?
2056 tensorHandleFactory.
CreateSubTensorHandle(*outputHandle, inputTensorInfo2.GetShape(), wOrigin2.data()) :
2061 inputTensorShapes.begin(),inputTensorShapes.end(), 2);
2065 AddInputToWorkload(data, info, inputTensorInfo1, inputHandle1.get());
2066 AddInputToWorkload(data, info, inputTensorInfo2, inputHandle2.get());
2067 AddOutputToWorkload(data, info, outputTensorInfo, outputHandle.get());
2072 std::unique_ptr<IWorkload> workload = workloadFactory.
CreateConcat(data, info);
2074 inputHandle1->Allocate();
2075 inputHandle2->Allocate();
2076 outputHandle->Allocate();
2081 workload->PostAllocationConfigure();
2082 workload->Execute();
2094 ConcatDifferentInputOutputQParamTest<DataType::QAsymmU8>(
2101 ConcatDifferentInputOutputQParamTest<DataType::QSymmS16>(
2118 unsigned int outputWidth = 3;
2119 unsigned int outputHeight = 6;
2120 unsigned int outputChannels = 3;
2122 unsigned int inputWidth1 = 3;
2123 unsigned int inputHeight1 = 6;
2124 unsigned int inputChannels1 = 2;
2126 unsigned int inputWidth2 = 3;
2127 unsigned int inputHeight2 = 6;
2128 unsigned int inputChannels2 = 1;
2137 ret.outputExpected = MakeTensor<float, 3>(outputTensorInfo, std::vector<float>(
2142 10.0f, 11.0f, 12.0f,
2143 13.0f, 14.0f, 15.0f,
2144 16.0f, 17.0f, 18.0f,
2146 19.0f, 20.0f, 21.0f,
2147 22.0f, 23.0f, 24.0f,
2148 25.0f, 26.0f, 27.0f,
2149 28.0f, 29.0f, 30.0f,
2150 31.0f, 32.0f, 33.0f,
2151 34.0f, 35.0f, 36.0f,
2153 37.0f, 38.0f, 39.0f,
2154 40.0f, 41.0f, 42.0f,
2155 43.0f, 44.0f, 45.0f,
2156 46.0f, 47.0f, 48.0f,
2157 49.0f, 50.0f, 51.0f,
2158 52.0f, 53.0f, 54.0f,
2162 auto input1 = MakeTensor<float, 3>(inputTensorInfo1, std::vector<float>(
2167 10.0f, 11.0f, 12.0f,
2168 13.0f, 14.0f, 15.0f,
2169 16.0f, 17.0f, 18.0f,
2171 19.0f, 20.0f, 21.0f,
2172 22.0f, 23.0f, 24.0f,
2173 25.0f, 26.0f, 27.0f,
2174 28.0f, 29.0f, 30.0f,
2175 31.0f, 32.0f, 33.0f,
2176 34.0f, 35.0f, 36.0f,
2180 auto input2 = MakeTensor<float, 3>(inputTensorInfo2, std::vector<float>(
2182 37.0f, 38.0f, 39.0f,
2183 40.0f, 41.0f, 42.0f,
2184 43.0f, 44.0f, 45.0f,
2185 46.0f, 47.0f, 48.0f,
2186 49.0f, 50.0f, 51.0f,
2187 52.0f, 53.0f, 54.0f,
2191 std::vector<unsigned int> wOrigin1 = {0, 0, 0};
2194 std::vector<unsigned int> wOrigin2 = {2, 0, 0};
2197 std::unique_ptr<ITensorHandle> outputHandle = tensorHandleFactory.
CreateTensorHandle(outputTensorInfo);
2201 std::unique_ptr<ITensorHandle> inputHandle1 =
2202 subTensorsSupported ?
2203 tensorHandleFactory.
CreateSubTensorHandle(*outputHandle, inputTensorInfo1.GetShape(), wOrigin1.data()) :
2206 std::unique_ptr<ITensorHandle> inputHandle2 =
2207 subTensorsSupported ?
2208 tensorHandleFactory.
CreateSubTensorHandle(*outputHandle, inputTensorInfo2.GetShape(), wOrigin2.data()) :
2213 AddInputToWorkload(data, info, inputTensorInfo1, inputHandle1.get());
2214 AddInputToWorkload(data, info, inputTensorInfo2, inputHandle2.get());
2215 AddOutputToWorkload(data, info, outputTensorInfo, outputHandle.get());
2220 std::unique_ptr<IWorkload> workload = workloadFactory.
CreateConcat(data, info);
2222 inputHandle1->Allocate();
2223 inputHandle2->Allocate();
2224 outputHandle->Allocate();
2229 workload->PostAllocationConfigure();
2230 workload->Execute();
2242 return Concat1dTestImpl<DataType::Float32>(workloadFactory, memoryManager, tensorHandleFactory, 0.0f, 0);
2250 return Concat2dDim0TestImpl<DataType::Float32>(workloadFactory, memoryManager, tensorHandleFactory, 0.0f, 0);
2258 return Concat2dDim1TestImpl<DataType::Float32>(workloadFactory, memoryManager, tensorHandleFactory, 0.0f, 0);
2266 return Concat2dDim0DiffInputDimsTestImpl<DataType::Float32>(workloadFactory, memoryManager,
2267 tensorHandleFactory, 0.0f, 0);
2275 return Concat2dDim1DiffInputDimsTestImpl<DataType::Float32>(workloadFactory,
2277 tensorHandleFactory,
2287 return Concat3dDim0TestImpl<DataType::Float32>(workloadFactory, memoryManager, tensorHandleFactory, 0.0f, 0);
2295 return Concat3dDim1TestImpl<DataType::Float32>(workloadFactory, memoryManager, tensorHandleFactory, 0.0f, 0);
2304 return Concat3dDim2TestImpl<DataType::Float32>(workloadFactory, memoryManager, tensorHandleFactory,
2305 useSubtensor, 0.0f, 0);
2313 return Concat3dDim0DiffInputDimsTestImpl<DataType::Float32>(
2314 workloadFactory, memoryManager, tensorHandleFactory, 0.0f, 0);
2322 return Concat3dDim1DiffInputDimsTestImpl<DataType::Float32>(workloadFactory, memoryManager,
2323 tensorHandleFactory, 0.0f, 0);
2332 return Concat3dDim2DiffInputDimsTestImpl<DataType::Float32>(
2333 workloadFactory, memoryManager, tensorHandleFactory, useSubtensor, 0.0f, 0);
2341 return Concat4dDim0TestImpl<DataType::Float32>(workloadFactory, memoryManager, tensorHandleFactory, 0.0f, 0);
2349 return Concat4dDim1TestImpl<DataType::Float32>(workloadFactory, memoryManager, tensorHandleFactory, 0.0f, 0);
2357 return Concat4dDim2TestImpl<DataType::Float32>(workloadFactory, memoryManager, tensorHandleFactory, 0.0f, 0);
2366 return Concat4dDim3TestImpl<DataType::Float32>(workloadFactory, memoryManager,
2367 tensorHandleFactory, 0.0f, 0, useSubtensor);
2375 return Concat4dDiffShapeDim0TestImpl<DataType::Float32>(workloadFactory, memoryManager,
2376 tensorHandleFactory, 0.0f, 0);
2384 return Concat4dDiffShapeDim1TestImpl<DataType::Float32>(
2385 workloadFactory, memoryManager, tensorHandleFactory, 0.0f, 0);
2393 return Concat4dDiffShapeDim2TestImpl<DataType::Float32>(workloadFactory, memoryManager,
2394 tensorHandleFactory, 0.0f, 0);
2403 return Concat4dDiffShapeDim3TestImpl<DataType::Float32>(
2404 workloadFactory, memoryManager, tensorHandleFactory, 0.0f, 0, useSubtensor);
2412 return Concat3dDim1TestImpl<DataType::Float16>(workloadFactory, memoryManager, tensorHandleFactory, 0.0f, 0);
2420 return Concat3dDim1TestImpl<DataType::BFloat16>(workloadFactory, memoryManager, tensorHandleFactory, 0.0f, 0);
2430 unsigned int outputWidth = 3;
2431 unsigned int outputHeight = 6;
2432 unsigned int outputChannels = 3;
2434 unsigned int inputWidth1 = 3;
2435 unsigned int inputHeight1 = 6;
2436 unsigned int inputChannels1 = 2;
2438 unsigned int inputWidth2 = 3;
2439 unsigned int inputHeight2 = 6;
2440 unsigned int inputChannels2 = 1;
2448 const float inputScale1 = 0.015686f;
2449 const int32_t inputOffset1 = 192;
2451 auto input1 = MakeTensor<uint8_t, 3>(inputTensorInfo1, std::vector<uint8_t>(
2470 const float inputScale2 = 0.019608f;
2471 const int32_t inputOffset2 = 50;
2473 auto input2 = MakeTensor<uint8_t, 3>(inputTensorInfo2, std::vector<uint8_t>(
2486 const float outputScale = 0.015686f;
2487 const int32_t outputOffset = 192;
2491 ret.
outputExpected = MakeTensor<uint8_t, 3>(outputTensorInfo, std::vector<uint8_t>(
2516 outputTensorInfo.SetQuantizationScale(outputScale);
2517 outputTensorInfo.SetQuantizationOffset(outputOffset);
2518 inputTensorInfo1.SetQuantizationScale(inputScale1);
2519 inputTensorInfo1.SetQuantizationOffset(inputOffset1);
2520 inputTensorInfo2.SetQuantizationScale(inputScale2);
2521 inputTensorInfo2.SetQuantizationOffset(inputOffset2);
2523 std::vector<unsigned int> wOrigin1 = { 0, 0, 0 };
2526 std::vector<unsigned int> wOrigin2 = { 2, 0, 0 };
2529 std::unique_ptr<ITensorHandle> outputHandle = tensorHandleFactory.
CreateTensorHandle(outputTensorInfo);
2533 std::unique_ptr<ITensorHandle> inputHandle1 =
2534 subTensorsSupported ?
2535 tensorHandleFactory.
CreateSubTensorHandle(*outputHandle, inputTensorInfo1.GetShape(), wOrigin1.data()) :
2538 std::unique_ptr<ITensorHandle> inputHandle2 =
2539 subTensorsSupported ?
2540 tensorHandleFactory.
CreateSubTensorHandle(*outputHandle, inputTensorInfo2.GetShape(), wOrigin2.data()) :
2545 AddInputToWorkload(data, info, inputTensorInfo1, inputHandle1.get());
2546 AddInputToWorkload(data, info, inputTensorInfo2, inputHandle2.get());
2547 AddOutputToWorkload(data, info, outputTensorInfo, outputHandle.get());
2552 std::unique_ptr<IWorkload> workload = workloadFactory.
CreateConcat(data, info);
2554 inputHandle1->Allocate();
2555 inputHandle2->Allocate();
2556 outputHandle->Allocate();
2561 workload->PostAllocationConfigure();
2562 workload->Execute();
2576 unsigned int outputWidth = 3;
2577 unsigned int outputHeight = 6;
2578 unsigned int outputChannels = 3;
2580 unsigned int inputWidth1 = 3;
2581 unsigned int inputHeight1 = 6;
2582 unsigned int inputChannels1 = 2;
2584 unsigned int inputWidth2 = 3;
2585 unsigned int inputHeight2 = 6;
2586 unsigned int inputChannels2 = 1;
2594 const float scale = 0.13497836f;
2595 const int32_t offset = -7;
2598 outputTensorInfo.SetQuantizationOffset(offset);
2599 inputTensorInfo1.SetQuantizationScale(scale);
2600 inputTensorInfo1.SetQuantizationOffset(offset);
2601 inputTensorInfo2.SetQuantizationScale(scale);
2602 inputTensorInfo2.SetQuantizationOffset(offset);
2606 ret.
outputExpected = MakeTensor<uint8_t, 3>(outputTensorInfo, std::vector<uint8_t>(
2631 auto input1 = MakeTensor<uint8_t, 3>(inputTensorInfo1, std::vector<uint8_t>(
2649 auto input2 = MakeTensor<uint8_t, 3>(inputTensorInfo2, std::vector<uint8_t>(
2660 std::vector<unsigned int> wOrigin1 = { 0, 0, 0 };
2663 std::vector<unsigned int> wOrigin2 = { 2, 0, 0 };
2666 std::unique_ptr<ITensorHandle> outputHandle = tensorHandleFactory.
CreateTensorHandle(outputTensorInfo);
2670 std::unique_ptr<ITensorHandle> inputHandle1 =
2671 subTensorsSupported ?
2672 tensorHandleFactory.
CreateSubTensorHandle(*outputHandle, inputTensorInfo1.GetShape(), wOrigin1.data()) :
2675 std::unique_ptr<ITensorHandle> inputHandle2 =
2676 subTensorsSupported ?
2677 tensorHandleFactory.
CreateSubTensorHandle(*outputHandle, inputTensorInfo2.GetShape(), wOrigin2.data()) :
2683 AddInputToWorkload(data, info, inputTensorInfo1, inputHandle1.get());
2684 AddInputToWorkload(data, info, inputTensorInfo2, inputHandle2.get());
2685 AddOutputToWorkload(data, info, outputTensorInfo, outputHandle.get());
2690 std::unique_ptr<IWorkload> workload = workloadFactory.
CreateConcat(data, info);
2692 inputHandle1->Allocate();
2693 inputHandle2->Allocate();
2694 outputHandle->Allocate();
2699 workload->PostAllocationConfigure();
2700 workload->Execute();
2714 unsigned int outputWidth = 3;
2715 unsigned int outputHeight = 6;
2716 unsigned int outputChannels = 3;
2718 unsigned int inputWidth1 = 3;
2719 unsigned int inputHeight1 = 6;
2720 unsigned int inputChannels1 = 2;
2722 unsigned int inputWidth2 = 3;
2723 unsigned int inputHeight2 = 6;
2724 unsigned int inputChannels2 = 1;
2732 const float scale = 0.13497836f;
2733 const int32_t offset = -7;
2736 outputTensorInfo.SetQuantizationOffset(offset);
2737 inputTensorInfo1.SetQuantizationScale(scale);
2738 inputTensorInfo1.SetQuantizationOffset(offset);
2739 inputTensorInfo2.SetQuantizationScale(scale);
2740 inputTensorInfo2.SetQuantizationOffset(offset);
2744 ret.
outputExpected = MakeTensor<uint16_t, 3>(outputTensorInfo, std::vector<uint16_t>(
2768 auto input1 = MakeTensor<uint16_t, 3>(inputTensorInfo1, std::vector<uint16_t>(
2785 auto input2 = MakeTensor<uint16_t, 3>(inputTensorInfo2, std::vector<uint16_t>(
2795 std::vector<unsigned int> wOrigin1 = { 0, 0, 0 };
2798 std::vector<unsigned int> wOrigin2 = { 2, 0, 0 };
2802 std::unique_ptr<ITensorHandle> outputHandle = tensorHandleFactory.
CreateTensorHandle(outputTensorInfo);
2806 std::unique_ptr<ITensorHandle> inputHandle1 =
2807 subTensorsSupported ?
2808 tensorHandleFactory.
CreateSubTensorHandle(*outputHandle, inputTensorInfo1.GetShape(), wOrigin1.data()) :
2811 std::unique_ptr<ITensorHandle> inputHandle2 =
2812 subTensorsSupported ?
2813 tensorHandleFactory.
CreateSubTensorHandle(*outputHandle, inputTensorInfo2.GetShape(), wOrigin2.data()) :
2819 AddInputToWorkload(data, info, inputTensorInfo1, inputHandle1.get());
2820 AddInputToWorkload(data, info, inputTensorInfo2, inputHandle2.get());
2821 AddOutputToWorkload(data, info, outputTensorInfo, outputHandle.get());
2826 std::unique_ptr<IWorkload> workload = workloadFactory.
CreateConcat(data, info);
2828 inputHandle1->Allocate();
2829 inputHandle2->Allocate();
2830 outputHandle->Allocate();
2835 workload->PostAllocationConfigure();
2836 workload->Execute();
2848 return Concat1dTestImpl<DataType::QAsymmU8>(workloadFactory, memoryManager, tensorHandleFactory, 0.5f, -1);
2856 return Concat2dDim0TestImpl<DataType::QAsymmU8>(workloadFactory, memoryManager, tensorHandleFactory, 0.5f, -1);
2864 return Concat2dDim1TestImpl<DataType::QAsymmU8>(workloadFactory, memoryManager, tensorHandleFactory, 0.5f, -1);
2872 return Concat2dDim0DiffInputDimsTestImpl<DataType::QAsymmU8>(
2873 workloadFactory, memoryManager, tensorHandleFactory, 0.5f, -1);
2881 return Concat2dDim1DiffInputDimsTestImpl<DataType::QAsymmU8>(
2882 workloadFactory, memoryManager, tensorHandleFactory, 0.5f, -1);
2890 return Concat3dDim0TestImpl<DataType::QAsymmU8>(workloadFactory, memoryManager, tensorHandleFactory, 0.5f, -1);
2898 return Concat3dDim1TestImpl<DataType::QAsymmU8>(workloadFactory, memoryManager, tensorHandleFactory, 0.5f, -1);
2907 return Concat3dDim2TestImpl<DataType::QAsymmU8>(
2908 workloadFactory, memoryManager, tensorHandleFactory, useSubtensor, 0.5f, -1);
2916 return Concat3dDim0TestImpl<DataType::QAsymmU8>(workloadFactory, memoryManager, tensorHandleFactory, 0.5f, -1);
2924 return Concat3dDim1DiffInputDimsTestImpl<DataType::QAsymmU8>(
2925 workloadFactory, memoryManager, tensorHandleFactory, 0.5f, -1);
2934 return Concat3dDim2DiffInputDimsTestImpl<DataType::QAsymmU8>(
2935 workloadFactory, memoryManager, tensorHandleFactory, useSubtensor, 0.5f, -1);
2943 return Concat4dDim0TestImpl<DataType::QAsymmU8>(workloadFactory, memoryManager, tensorHandleFactory, 0.5f, -1);
2951 return Concat4dDim1TestImpl<DataType::QAsymmU8>(workloadFactory, memoryManager, tensorHandleFactory, 0.5f, -1);
2959 return Concat4dDim2TestImpl<DataType::QAsymmU8>(workloadFactory, memoryManager, tensorHandleFactory, 0.5f, -1);
2967 return Concat4dDim3TestImpl<DataType::QAsymmU8>(
2968 workloadFactory, memoryManager, tensorHandleFactory, 0.5f, -1, useSubtensor);
2976 return Concat4dDiffShapeDim0TestImpl<DataType::QAsymmU8>(
2977 workloadFactory, memoryManager, tensorHandleFactory, 0.5f, -1);
2985 return Concat4dDiffShapeDim1TestImpl<DataType::QAsymmU8>(
2986 workloadFactory, memoryManager, tensorHandleFactory, 0.5f, -1);
2994 return Concat4dDiffShapeDim2TestImpl<DataType::QAsymmU8>(
2995 workloadFactory, memoryManager, tensorHandleFactory, 0.5f, -1);
3004 return Concat4dDiffShapeDim3TestImpl<DataType::QAsymmU8>(
3005 workloadFactory, memoryManager, tensorHandleFactory, 0.5f, -1, useSubtensor);
LayerTestResult< uint16_t, 3 > ConcatUint16Test(IWorkloadFactory &workloadFactory, const IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory)
LayerTestResult< uint8_t, 4 > Concat4dDiffShapeDim3Uint8Test(IWorkloadFactory &workloadFactory, const IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory, bool useSubtensor)
LayerTestResult< float, 3 > Concat3dDim0Test(IWorkloadFactory &workloadFactory, const IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory)
LayerTestResult< float, 2 > Concat2dDim0Test(IWorkloadFactory &workloadFactory, const IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory)
LayerTestResult< T, 2 > Concat2dDim1TestImpl(IWorkloadFactory &workloadFactory, const IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory, float qScale, int32_t qOffset)
LayerTestResult< float, 4 > Concat4dDim0Test(IWorkloadFactory &workloadFactory, const IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory)
LayerTestResult< float, 3 > ConcatTest(IWorkloadFactory &workloadFactory, const IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory)
LayerTestResult< T, 4 > Concat4dDim2TestImpl(IWorkloadFactory &workloadFactory, const IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory, float qScale, int32_t qOffset)
LayerTestResult< uint8_t, 3 > Concat3dDim0DiffInputDimsUint8Test(IWorkloadFactory &workloadFactory, const IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory)
const TensorShape & GetShape() const
LayerTestResult< uint8_t, 4 > Concat4dDiffShapeDim1Uint8Test(IWorkloadFactory &workloadFactory, const IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory)
LayerTestResult< T, 2 > Concat2dDim0DiffInputDimsTestImpl(IWorkloadFactory &workloadFactory, const IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory, float qScale, int32_t qOffset)
LayerTestResult< uint8_t, 2 > Concat2dDim0DiffInputDimsUint8Test(IWorkloadFactory &workloadFactory, const IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory)
LayerTestResult< uint8_t, 3 > Concat3dDim1DiffInputDimsUint8Test(IWorkloadFactory &workloadFactory, const IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory)
LayerTestResult< uint8_t, 3 > Concat3dDim2DiffInputDimsUint8Test(IWorkloadFactory &workloadFactory, const IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory, bool useSubtensor)
boost::multi_array< T, n > outputExpected
virtual std::unique_ptr< ITensorHandle > CreateSubTensorHandle(ITensorHandle &parent, TensorShape const &subTensorShape, unsigned int const *subTensorOrigin) const =0
LayerTestResult< float, 2 > Concat2dDim1Test(IWorkloadFactory &workloadFactory, const IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory)
LayerTestResult< uint8_t, 4 > Concat4dDim1Uint8Test(IWorkloadFactory &workloadFactory, const IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory)
LayerTestResult< uint8_t, 2 > Concat2dDim0Uint8Test(IWorkloadFactory &workloadFactory, const IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory)
LayerTestResult< BFloat16, 3 > ConcatBFloat16Test(IWorkloadFactory &workloadFactory, const IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory)
LayerTestResult< float, 4 > Concat4dDim2Test(IWorkloadFactory &workloadFactory, const IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory)
LayerTestResult< uint8_t, 2 > Concat2dDim1DiffInputDimsUint8Test(IWorkloadFactory &workloadFactory, const IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory)
LayerTestResult< float, 4 > Concat4dDiffShapeDim1Test(IWorkloadFactory &workloadFactory, const IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory)
LayerTestResult< float, 3 > Concat3dDim1DiffInputDimsTest(IWorkloadFactory &workloadFactory, const IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory)
Copyright (c) 2021 ARM Limited and Contributors.
void IgnoreUnused(Ts &&...)
LayerTestResult< float, 3 > Concat3dDim2DiffInputDimsTest(IWorkloadFactory &workloadFactory, const IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory, bool useSubtensor)
LayerDescriptor m_Parameters
void Generate3dPermuteVectorForConcat(unsigned int numDimensions, unsigned int &concatDim, std::pair< PermutationVector, PermutationVector > &permutations)
LayerTestResult< T, 4 > Concat4dDiffShapeDim2TestImpl(IWorkloadFactory &workloadFactory, const IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory, float qScale, int32_t qOffset)
LayerTestResult< uint8_t, 4 > Concat4dDim3Uint8Test(IWorkloadFactory &workloadFactory, const IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory, bool useSubtensor)
LayerTestResult< uint8_t, 2 > Concat2dDim1Uint8Test(IWorkloadFactory &workloadFactory, const IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory)
virtual std::unique_ptr< IWorkload > CreateConcat(const ConcatQueueDescriptor &descriptor, const WorkloadInfo &info) const
void SetShape(const TensorShape &newShape)
LayerTestResult< T, 2 > Concat2dTestImpl(IWorkloadFactory &workloadFactory, const IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory, const TensorInfo &outputTensorInfo, unsigned int dimension, const float qScale, const int32_t qOffset)
LayerTestResult< T, 1 > Concat1dTestImpl(IWorkloadFactory &workloadFactory, const IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory, float qScale, int32_t qOffset)
const uint32_t * GetViewOrigin(uint32_t idx) const
Return the view origin at the int value idx.
LayerTestResult< float, 2 > Concat2dDim0DiffInputDimsTest(IWorkloadFactory &workloadFactory, const IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory)
std::vector< ViewOrigin > m_ViewOrigins
#define ARMNN_ASSERT_MSG(COND, MSG)
LayerTestResult< float, 3 > Concat3dDim1Test(IWorkloadFactory &workloadFactory, const IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory)
std::shared_ptr< IMemoryManager > IMemoryManagerSharedPtr
LayerTestResult< T, 3 > Concat3dDim0DiffInputDimsTestImpl(IWorkloadFactory &workloadFactory, const IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory, float qScale, int32_t qOffset)
void Concatenate(const ConcatQueueDescriptor &data, std::vector< ITensorHandle *> inputs, std::vector< ITensorHandle *> outputs)
An OriginsDescriptor for the ConcatLayer.
LayerTestResult< float, 4 > Concat4dDiffShapeDim0Test(IWorkloadFactory &workloadFactory, const IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory)
LayerTestResult< T, 4 > Concat4dDiffShapeDim1TestImpl(IWorkloadFactory &workloadFactory, const IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory, float qScale, int32_t qOffset)
LayerTestResult< uint8_t, 3 > ConcatUint8DifferentQParamsTest(IWorkloadFactory &workloadFactory, const IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory)
void SetQuantizationScale(float scale)
#define ARMNN_ASSERT(COND)
LayerTestResult< uint8_t, 4 > Concat4dDiffShapeDim0Uint8Test(IWorkloadFactory &workloadFactory, const IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory)
LayerTestResult< T, 4 > Concat4dTestImpl(IWorkloadFactory &workloadFactory, const IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory, const TensorInfo &outputTensorInfo, unsigned int dimension, bool useSubtensor, float qScale, int32_t qOffset)
LayerTestResult< Half, 3 > ConcatFloat16Test(IWorkloadFactory &workloadFactory, const IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory)
OriginsDescriptor CreateDescriptorForConcat(const std::vector< TensorInfo > &inputTensorInfos, unsigned int concatDim)
void CopyDataFromITensorHandle(void *memory, const armnn::ITensorHandle *tensorHandle)
LayerTestResult< uint8_t, 3 > Concat3dDim1Uint8Test(IWorkloadFactory &workloadFactory, const IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory)
virtual std::unique_ptr< IWorkload > CreatePermute(const PermuteQueueDescriptor &descriptor, const WorkloadInfo &info) const
void PermuteInputsForConcat(IWorkloadFactory &workloadFactory, const IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory, std::vector< TensorInfo > &inputTensorInfos, std::vector< T *> &inputData, std::vector< std::vector< T >> &inputDataStorage, PermutationVector &permuteVector, unsigned int &concatDim, TensorInfo &outputTensorInfo)
LayerTestResult< T, 3 > Concat3dDim0TestImpl(IWorkloadFactory &workloadFactory, const IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory, float qScale, int32_t qOffset)
LayerTestResult< float, 3 > Concat3dDim2Test(IWorkloadFactory &workloadFactory, const IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory, bool useSubtensor)
LayerTestResult< T, 3 > Concat3dDim1TestImpl(IWorkloadFactory &workloadFactory, const IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory, float qScale, int32_t qOffset)
LayerTestResult< float, 4 > Concat4dDiffShapeDim2Test(IWorkloadFactory &workloadFactory, const IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory)
TensorShape ExpandTensorShapeTo3dForPermute(const TensorShape &inputShape)
LayerTestResult< T, 2 > Concat2dDim1DiffInputDimsTestImpl(IWorkloadFactory &workloadFactory, const IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory, float qScale, int32_t qOffset)
boost::multi_array< T, n > output
LayerTestResult< T, 2 > Concat2dDim0TestImpl(IWorkloadFactory &workloadFactory, const IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory, float qScale, int32_t qOffset)
bool IsEqual(const PermutationVector &other) const
LayerTestResult< float, 4 > Concat4dDim1Test(IWorkloadFactory &workloadFactory, const IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory)
LayerTestResult< uint8_t, 4 > Concat4dDiffShapeDim2Uint8Test(IWorkloadFactory &workloadFactory, const IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory)
LayerTestResult< T, 3 > Concat3dDim2TestImpl(IWorkloadFactory &workloadFactory, const IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory, bool useSubtensor, float qScale, int32_t qOffset)
LayerTestResult< float, 3 > Concat3dDim0DiffInputDimsTest(IWorkloadFactory &workloadFactory, const IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory)
LayerTestResult< T, 4 > Concat4dDim1TestImpl(IWorkloadFactory &workloadFactory, const IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory, float qScale, int32_t qOffset)
LayerTestResult< T, 4 > Concat4dDiffShapeDim3TestImpl(IWorkloadFactory &workloadFactory, const IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory, float qScale, int32_t qOffset, bool useSubtensor)
LayerTestResult< float, 4 > Concat4dDim3Test(IWorkloadFactory &workloadFactory, const IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory, bool useSubtensor)
unsigned int GetNumDimensions() const
Function that returns the tensor rank.
LayerTestResult< uint8_t, 3 > Concat3dDim0Uint8Test(IWorkloadFactory &workloadFactory, const IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory)
uint32_t GetNumDimensions() const
Get the number of dimensions.
LayerTestResult< uint8_t, 3 > ConcatUint8Test(IWorkloadFactory &workloadFactory, const IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory)
LayerTestResult< T, 3 > Concat3dTestImpl(IWorkloadFactory &workloadFactory, const IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory, const TensorInfo &outputTensorInfo, unsigned int dimension, bool useSubtensor, float qScale, int32_t qOffset)
LayerTestResult< uint8_t, 1 > Concat1dUint8Test(IWorkloadFactory &workloadFactory, const IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory)
LayerTestResult< float, 2 > Concat2dDim1DiffInputDimsTest(IWorkloadFactory &workloadFactory, const IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory)
void PermuteTensorData(IWorkloadFactory &workloadFactory, const IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory, const PermutationVector &mappings, TensorInfo &inputTensorInfo, const T *inputData, std::vector< T > &outputData)
Contains information about inputs and outputs to a layer.
LayerTestResult< T, 3 > Concat3dDim2DiffInputDimsTestImpl(IWorkloadFactory &workloadFactory, const IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory, bool useSubtensor, float qScale, int32_t qOffset)
OriginsDescriptor CreateDescriptorForConcatenation(TensorShapeIt first, TensorShapeIt last, unsigned int concatenationDimension)
Convenience template to create an OriginsDescriptor to use when creating a ConcatLayer for performing...
uint32_t GetNumViews() const
Get the number of views.
LayerTestResult< T, 4 > Concat4dDim0TestImpl(IWorkloadFactory &workloadFactory, const IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory, float qScale, int32_t qOffset)
LayerTestResult< uint8_t, 4 > Concat4dDim2Uint8Test(IWorkloadFactory &workloadFactory, const IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory)
LayerTestResult< uint8_t, 3 > Concat3dDim2Uint8Test(IWorkloadFactory &workloadFactory, const IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory, bool useSubtensor)
LayerTestResult< T, 3 > ConcatDifferentInputOutputQParamTest(IWorkloadFactory &workloadFactory, const IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory, bool useSubtensor)
LayerTestResult< T, 4 > Concat4dDim3TestImpl(IWorkloadFactory &workloadFactory, const IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory, float qScale, int32_t qOffset, bool useSubtensor)
LayerTestResult< T, 3 > Concat3dDim1DiffInputDimsTestImpl(IWorkloadFactory &workloadFactory, const IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory, float qScale, int32_t qOffset)
armnn::TensorShape Permuted(const armnn::TensorShape &srcShape, const armnn::PermutationVector &mappings)
virtual std::unique_ptr< ITensorHandle > CreateTensorHandle(const TensorInfo &tensorInfo) const =0
LayerTestResult< float, 4 > Concat4dDiffShapeDim3Test(IWorkloadFactory &workloadFactory, const IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory, bool useSubtensor)
LayerTestResult< uint8_t, 4 > Concat4dDim0Uint8Test(IWorkloadFactory &workloadFactory, const IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory)
LayerTestResult< float, 1 > Concat1dTest(IWorkloadFactory &workloadFactory, const IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory)
unsigned int GetNumElements() const
bool NeedPermuteForConcat(const std::vector< TensorInfo > &inputTensorInfos, unsigned int concatDim)
void PermuteOutputForConcat(IWorkloadFactory &workloadFactory, const IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory, const TensorInfo &tensorInfo, const PermutationVector &permuteVector, std::unique_ptr< ITensorHandle > &&inputDataHandle, T *data)
A PermuteDescriptor for the PermuteLayer.
void CopyDataToITensorHandle(armnn::ITensorHandle *tensorHandle, const void *memory)
LayerTestResult< T, 4 > Concat4dDiffShapeDim0TestImpl(IWorkloadFactory &workloadFactory, const IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory, float qScale, int32_t qOffset)
virtual bool SupportsSubTensors() const =0