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());
154 inputHandle->Allocate();
155 outputHandle->Allocate();
159 workload->PostAllocationConfigure();
164 inputTensorInfo = outputTensorInfo;
177 std::vector<TensorInfo> & inputTensorInfos,
178 std::vector<T *> & inputData,
179 std::vector<std::vector<T>> & inputDataStorage,
181 unsigned int & concatDim,
186 "Expecting more than one tensor to be concatenated here");
188 unsigned int numDims = 0;
189 unsigned int nthInput = 0;
192 std::pair<PermutationVector, PermutationVector> permutations =
193 std::make_pair(identity, identity);
195 inputDataStorage.resize(inputData.size());
197 for (
auto && tensorInfo : inputTensorInfos)
201 numDims = tensorInfo.GetShape().GetNumDimensions();
205 permuteVector = permutations.second;
207 "Test logic error, we don't need permutation, so we shouldn't arrive here");
212 "All inputs must have the same number of dimensions");
218 PermuteTensorData<T>(workloadFactory,
224 inputDataStorage[nthInput]);
226 inputData[nthInput] = inputDataStorage[nthInput].data();
227 inputTensorInfos[nthInput] = newTensorInfo;
235 permutations.first));
249 std::unique_ptr<ITensorHandle> && inputDataHandle,
263 std::vector<T> outputData;
267 PermuteTensorData<T>(workloadFactory,
275 ::memcpy(data, &outputData[0],
sizeof(T)*outputData.size());
282 std::initializer_list<const TensorInfo> inputTensorInfosOrig,
283 std::initializer_list<T *> inputsOrig,
286 unsigned int concatDim,
290 if (output ==
nullptr)
299 std::vector<TensorInfo> inputTensorInfos(inputTensorInfosOrig.begin(), inputTensorInfosOrig.end());
300 std::vector<T *> inputs = inputsOrig;
301 TensorInfo outputTensorInfo = outputTensorInfoOrig;
306 std::vector<std::vector<T>> tmpInputDataStorage;
308 const size_t inputCount = inputTensorInfos.size();
312 if (needPermuteForConcat)
318 PermuteInputsForConcat<T>(workloadFactory,
331 std::vector<std::unique_ptr<ITensorHandle>> inputHandles;
332 inputHandles.reserve(inputCount);
334 std::unique_ptr<ITensorHandle> outputHandle = tensorHandleFactory.
CreateTensorHandle(outputTensorInfo);
343 for (
unsigned int i = 0; i < viewsDescriptor.
GetNumViews(); ++i)
352 for (
unsigned int i = 0; i < inputCount; ++i)
354 const TensorInfo& inputTensorInfo = inputTensorInfos[i];
356 std::unique_ptr<ITensorHandle> inputHandle =
357 subTensorsSupported ?
363 inputHandles.emplace_back(std::move(inputHandle));
370 for (
unsigned int i = 0; i < inputCount; ++i)
372 std::unique_ptr<ITensorHandle> inputHandle = tensorHandleFactory.
CreateTensorHandle(inputTensorInfos[i]);
373 inputHandles.emplace_back(std::move(inputHandle));
377 for (
unsigned int i = 0; i < inputCount; ++i)
379 AddInputToWorkload(queueDescriptor, workloadInfo, inputTensorInfos[i], inputHandles[i].
get());
382 AddOutputToWorkload(queueDescriptor, workloadInfo, outputTensorInfo, outputHandle.get());
384 std::unique_ptr<IWorkload> workload
387 for (
auto& inputHandle : inputHandles)
389 inputHandle->Allocate();
392 outputHandle->Allocate();
394 unsigned int nextInputId = 0;
395 for (
auto& inputHandle : inputHandles)
401 workload->PostAllocationConfigure();
404 if (needPermuteForConcat)
406 PermuteOutputForConcat<T>(workloadFactory,
411 std::move(outputHandle),
423 template<DataType ArmnnType,
typename T = ResolveType<ArmnnType>>
432 unsigned int outputWidth = 3;
433 unsigned int outputHeight = 6;
434 unsigned int outputChannels = 3;
436 unsigned int inputWidth1 = 3;
437 unsigned int inputHeight1 = 6;
438 unsigned int inputChannels1 = 2;
440 unsigned int inputWidth2 = 3;
441 unsigned int inputHeight2 = 6;
442 unsigned int inputChannels2 = 1;
445 TensorInfo outputTensorInfo({ outputChannels, outputHeight, outputWidth }, ArmnnType);
446 TensorInfo inputTensorInfo1({ inputChannels1, inputHeight1, inputWidth1 }, ArmnnType);
447 TensorInfo inputTensorInfo2({ inputChannels2, inputHeight2, inputWidth2 }, ArmnnType);
449 std::vector<T> actualOutput(outputTensorInfo.GetNumElements());
451 std::vector<T> expectedOutput =
475 std::vector<T> input1 =
492 std::vector<T> input2 =
502 std::vector<unsigned int> wOrigin1 = {0, 0, 0};
505 std::vector<unsigned int> wOrigin2 = {2, 0, 0};
508 std::unique_ptr<ITensorHandle> outputHandle = tensorHandleFactory.
CreateTensorHandle(outputTensorInfo);
512 std::unique_ptr<ITensorHandle> inputHandle1 =
513 subTensorsSupported ?
514 tensorHandleFactory.
CreateSubTensorHandle(*outputHandle, inputTensorInfo1.GetShape(), wOrigin1.data()) :
517 std::unique_ptr<ITensorHandle> inputHandle2 =
518 subTensorsSupported ?
519 tensorHandleFactory.
CreateSubTensorHandle(*outputHandle, inputTensorInfo2.GetShape(), wOrigin2.data()) :
524 AddInputToWorkload(data, info, inputTensorInfo1, inputHandle1.get());
525 AddInputToWorkload(data, info, inputTensorInfo2, inputHandle2.get());
526 AddOutputToWorkload(data, info, outputTensorInfo, outputHandle.get());
533 inputHandle1->Allocate();
534 inputHandle2->Allocate();
535 outputHandle->Allocate();
540 workload->PostAllocationConfigure();
547 outputHandle->GetShape(),
548 outputTensorInfo.GetShape());
551 template<DataType ArmnnType,
typename T = ResolveType<ArmnnType>>
559 TensorInfo inputTensorInfo({ 3 }, ArmnnType, qScale, qOffset);
561 auto input0 = QuantizedVector<T>({ 1.0f, 2.0f, 3.0f }, qScale, qOffset);
562 auto input1 = QuantizedVector<T>({ 4.0f, 5.0f, 6.0f }, qScale, qOffset);
563 auto input2 = QuantizedVector<T>({ 7.0f, 8.0f, 9.0f }, qScale, qOffset);
565 TensorInfo outputTensorInfo({ 9 }, ArmnnType, qScale, qOffset);
569 std::vector<T> output;
570 output.resize(outputTensorInfo.GetNumElements());
571 Concatenate<T>(workloadFactory, memoryManager, tensorHandleFactory,
572 { inputTensorInfo, inputTensorInfo, inputTensorInfo },
573 { input0.data(), input1.data(), input2.data() },
579 result.m_ActualData = output;
580 result.m_ExpectedData = QuantizedVector<T>(
582 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f
589 template<DataType ArmnnType,
typename T = ResolveType<ArmnnType>>
595 unsigned int dimension,
597 const int32_t qOffset)
599 TensorInfo inputTensorInfo({ 2, 3 }, ArmnnType, qScale, qOffset);
601 auto input0 = QuantizedVector<T>(
611 auto input1 = QuantizedVector<T>(
621 auto input2 = QuantizedVector<T>(
633 std::vector<T> output;
635 Concatenate<T>(workloadFactory, memoryManager, tensorHandleFactory,
636 { inputTensorInfo, inputTensorInfo, inputTensorInfo },
637 { input0.data(), input1.data(), input2.data() },
643 result.m_ActualData = output;
647 template<DataType ArmnnType,
typename T = ResolveType<ArmnnType>>
655 TensorInfo outputTensorInfo({ 6, 3 }, ArmnnType, qScale, qOffset);
658 workloadFactory, memoryManager, tensorHandleFactory, outputTensorInfo, 0, qScale, qOffset);
685 template<DataType ArmnnType,
typename T = ResolveType<ArmnnType>>
693 TensorInfo outputTensorInfo({ 2, 9 }, ArmnnType, qScale, qOffset);
696 workloadFactory, memoryManager, tensorHandleFactory, outputTensorInfo, 1, qScale, qOffset);
701 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f,
704 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 16.0f, 17.0f, 18.0f
711 template<DataType ArmnnType,
typename T = ResolveType<ArmnnType>>
719 TensorInfo input0TensorInfo({ 2, 3 }, ArmnnType, qScale, qOffset);
720 auto input0 = QuantizedVector<T>(
730 TensorInfo input1TensorInfo({ 3, 3 }, ArmnnType, qScale, qOffset);
731 auto input1 = QuantizedVector<T>(
744 TensorInfo input2TensorInfo({ 1, 3 }, ArmnnType, qScale, qOffset);
745 auto input2 = QuantizedVector<T>(
752 TensorInfo outputTensorInfo({ 6, 3 }, ArmnnType, qScale, qOffset);
755 std::vector<T> output;
756 output.resize(outputTensorInfo.GetNumElements());
757 Concatenate<T>(workloadFactory, memoryManager, tensorHandleFactory,
758 { input0TensorInfo, input1TensorInfo, input2TensorInfo },
759 { input0.data(), input1.data(), input2.data() },
765 result.m_ActualData = output;
766 result.m_ExpectedData = QuantizedVector<T>(
791 template<DataType ArmnnType,
typename T = ResolveType<ArmnnType>>
799 TensorInfo input0TensorInfo({ 2, 3 }, ArmnnType, qScale, qOffset);
800 auto input0 = QuantizedVector<T>(
810 TensorInfo input1TensorInfo({ 2, 5 }, ArmnnType, qScale, qOffset);
811 auto input1 = QuantizedVector<T>(
814 4.0f, 5.0f, 6.0f, 7.0f, 8.0f,
817 13.0f, 14.0f, 15.0f, 16.0f, 17.0f,
821 TensorInfo input2TensorInfo({ 2, 1 }, ArmnnType, qScale, qOffset);
822 auto input2 = QuantizedVector<T>(
832 TensorInfo outputTensorInfo({ 2, 9 }, ArmnnType, qScale, qOffset);
835 std::vector<T> output;
836 output.resize(outputTensorInfo.GetNumElements());
837 Concatenate<T>(workloadFactory, memoryManager, tensorHandleFactory,
838 { input0TensorInfo, input1TensorInfo, input2TensorInfo },
839 { input0.data(), input1.data(), input2.data() },
845 result.m_ActualData = output;
846 result.m_ExpectedData = QuantizedVector<T>(
849 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f,
852 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 16.0f, 17.0f, 18.0f,
859 template<DataType ArmnnType,
typename T = ResolveType<ArmnnType>>
865 unsigned int dimension,
870 TensorInfo inputTensorInfo({ 2, 3, 2 }, ArmnnType, qScale, qOffset);
872 auto input0 = QuantizedVector<T>(
894 auto input1 = QuantizedVector<T>(
916 auto input2 = QuantizedVector<T>(
940 std::vector<T> output;
942 Concatenate<T>(workloadFactory, memoryManager, tensorHandleFactory,
943 { inputTensorInfo, inputTensorInfo, inputTensorInfo },
944 { input0.data(), input1.data(), input2.data() },
950 result.m_ActualData = output;
954 template<DataType ArmnnType,
typename T = ResolveType<ArmnnType>>
962 TensorInfo outputTensorInfo({ 6, 3, 2 }, ArmnnType, qScale, qOffset);
965 workloadFactory, memoryManager, tensorHandleFactory, outputTensorInfo, 0,
true, qScale, qOffset);
1028 template<DataType ArmnnType,
typename T = ResolveType<ArmnnType>>
1036 TensorInfo outputTensorInfo({ 2, 9, 2 }, ArmnnType, qScale, qOffset);
1039 workloadFactory, memoryManager, tensorHandleFactory, outputTensorInfo, 1,
true, qScale, qOffset);
1102 template<DataType ArmnnType,
typename T = ResolveType<ArmnnType>>
1111 TensorInfo outputTensorInfo({ 2, 3, 6 }, ArmnnType, qScale, qOffset);
1114 workloadFactory, memoryManager, tensorHandleFactory, outputTensorInfo, 2, useSubtensor, qScale, qOffset);
1119 1.0f, 2.0f, 7.0f, 8.0f, 13.0f, 14.0f,
1122 3.0f, 4.0f, 9.0f, 10.0f, 15.0f, 16.0f,
1125 5.0f, 6.0f, 11.0f, 12.0f, 17.0f, 18.0f,
1128 19.0f, 20.0f, 25.0f, 26.0f, 31.0f, 32.0f,
1131 21.0f, 22.0f, 27.0f, 28.0f, 33.0f, 34.0f,
1134 23.0f, 24.0f, 29.0f, 30.0f, 35.0f, 36.0f,
1141 template<DataType ArmnnType,
typename T = ResolveType<ArmnnType>>
1149 TensorInfo input0TensorInfo({ 2, 3, 2 }, ArmnnType);
1150 auto input0 = QuantizedVector<T>(
1172 TensorInfo input1TensorInfo({ 1, 3, 2 }, ArmnnType);
1173 auto input1 = QuantizedVector<T>(
1186 TensorInfo input2TensorInfo({ 3, 3, 2 }, ArmnnType);
1187 auto input2 = QuantizedVector<T>(
1218 TensorInfo outputTensorInfo({ 6, 3, 2 }, ArmnnType);
1221 std::vector<T> output;
1222 output.resize(outputTensorInfo.GetNumElements());
1223 Concatenate<T>(workloadFactory, memoryManager, tensorHandleFactory,
1224 { input0TensorInfo, input1TensorInfo, input2TensorInfo },
1225 { input0.data(), input1.data(), input2.data() },
1231 result.m_ActualData = output;
1232 result.m_ExpectedData = QuantizedVector<T>(
1293 template<DataType ArmnnType,
typename T = ResolveType<ArmnnType>>
1301 TensorInfo input0TensorInfo({ 2, 3, 2 }, ArmnnType, qScale, qOffset);
1302 auto input0 = QuantizedVector<T>(
1324 TensorInfo input1TensorInfo({ 2, 4, 2 }, ArmnnType, qScale, qOffset);
1325 auto input1 = QuantizedVector<T>(
1353 TensorInfo input2TensorInfo({ 2, 1, 2 }, ArmnnType, qScale, qOffset);
1354 auto input2 = QuantizedVector<T>(
1364 TensorInfo outputTensorInfo({ 2, 8, 2 }, ArmnnType, qScale, qOffset);
1367 std::vector<T> output;
1368 output.resize(outputTensorInfo.GetNumElements());
1369 Concatenate<T>(workloadFactory, memoryManager, tensorHandleFactory,
1370 { input0TensorInfo, input1TensorInfo, input2TensorInfo },
1371 { input0.data(), input1.data(), input2.data() },
1377 result.m_ActualData = output;
1378 result.m_ExpectedData = QuantizedVector<T>(
1433 template<DataType ArmnnType,
typename T = ResolveType<ArmnnType>>
1442 TensorInfo input0TensorInfo({ 2, 3, 2 }, ArmnnType, qScale, qOffset);
1443 auto input0 = QuantizedVector<T>(
1465 TensorInfo input1TensorInfo({ 2, 3, 1 }, ArmnnType, qScale, qOffset);
1466 auto input1 = QuantizedVector<T>(
1488 TensorInfo input2TensorInfo({ 2, 3, 3 }, ArmnnType, qScale, qOffset);
1489 auto input2 = QuantizedVector<T>(
1492 13.0f, 14.0f, 50.0f,
1495 15.0f, 16.0f, 51.0f,
1498 17.0f, 18.0f, 52.0f,
1501 31.0f, 32.0f, 53.0f,
1504 33.0f, 34.0f, 54.0f,
1507 35.0f, 36.0f, 55.0f,
1511 TensorInfo outputTensorInfo({ 2, 3, 6 }, ArmnnType, qScale, qOffset);
1514 std::vector<T> output;
1515 output.resize(outputTensorInfo.GetNumElements());
1516 Concatenate<T>(workloadFactory, memoryManager, tensorHandleFactory,
1517 { input0TensorInfo, input1TensorInfo, input2TensorInfo },
1518 { input0.data(), input1.data(), input2.data() },
1524 result.m_ActualData = output;
1525 result.m_ExpectedData = QuantizedVector<T>(
1528 1.0f, 2.0f, 7.0f, 13.0f, 14.0f, 50.0f,
1531 3.0f, 4.0f, 9.0f, 15.0f, 16.0f, 51.0f,
1534 5.0f, 6.0f, 11.0f, 17.0f, 18.0f, 52.0f,
1537 19.0f, 20.0f, 25.0f, 31.0f, 32.0f, 53.0f,
1540 21.0f, 22.0f, 27.0f, 33.0f, 34.0f, 54.0f,
1543 23.0f, 24.0f, 29.0f, 35.0f, 36.0f, 55.0f,
1550 template<DataType ArmnnType,
typename T = ResolveType<ArmnnType>>
1556 unsigned int dimension,
1561 TensorInfo inputTensorInfo({ 1, 3, 2, 2 }, ArmnnType, qScale, qOffset);
1563 auto input0 = QuantizedVector<T>(
1574 auto input1 = QuantizedVector<T>(
1585 auto input2 = QuantizedVector<T>(
1598 std::vector<T> output;
1601 Concatenate<T>(workloadFactory,
1603 tensorHandleFactory,
1604 {inputTensorInfo, inputTensorInfo, inputTensorInfo},
1605 {input0.data(), input1.data(), input2.data()},
1611 result.m_ActualData = output;
1615 template<DataType ArmnnType,
typename T = ResolveType<ArmnnType>>
1623 TensorInfo outputTensorInfo({ 3, 3, 2, 2 }, ArmnnType, qScale, qOffset);
1626 workloadFactory, memoryManager, tensorHandleFactory, outputTensorInfo, 0,
true, qScale, qOffset);
1656 template<DataType ArmnnType,
typename T = ResolveType<ArmnnType>>
1664 TensorInfo outputTensorInfo({ 1, 9, 2, 2 }, ArmnnType, qScale, qOffset);
1667 workloadFactory, memoryManager, tensorHandleFactory, outputTensorInfo, 1,
true, qScale, qOffset);
1697 template<DataType ArmnnType,
typename T = ResolveType<ArmnnType>>
1705 TensorInfo outputTensorInfo({ 1, 3, 6, 2 }, ArmnnType, qScale, qOffset);
1708 workloadFactory, memoryManager, tensorHandleFactory, outputTensorInfo, 2,
true, qScale, qOffset);
1738 template<DataType ArmnnType,
typename T = ResolveType<ArmnnType>>
1747 TensorInfo outputTensorInfo({ 1, 3, 2, 6 }, ArmnnType, qScale, qOffset);
1750 workloadFactory, memoryManager, tensorHandleFactory, outputTensorInfo, 3, useSubtensor, qScale, qOffset);
1780 template<DataType ArmnnType,
typename T = ResolveType<ArmnnType>>
1788 constexpr
unsigned int dimension = 0u;
1790 TensorInfo inputTensorInfo0({ 1, 3, 2, 2 }, ArmnnType, qScale, qOffset);
1791 auto input0 = QuantizedVector<T>(
1802 TensorInfo inputTensorInfo1({ 2, 3, 2, 2 }, ArmnnType, qScale, qOffset);
1804 auto input1 = QuantizedVector<T>(
1822 TensorInfo outputTensorInfo({ 3, 3, 2, 2 }, ArmnnType, qScale, qOffset);
1826 std::vector<T> output;
1827 output.resize(outputTensorInfo.GetNumElements());
1828 Concatenate<T>(workloadFactory,
1830 tensorHandleFactory,
1831 {inputTensorInfo0, inputTensorInfo1},
1832 {input0.data(), input1.data()},
1838 result.m_ActualData = output;
1839 result.m_ExpectedData = QuantizedVector<T>(
1867 template<DataType ArmnnType,
typename T = ResolveType<ArmnnType>>
1875 constexpr
unsigned int dimension = 1u;
1877 TensorInfo inputTensorInfo0({ 1, 3, 2, 2 }, ArmnnType, qScale, qOffset);
1878 auto input0 = QuantizedVector<T>(
1889 TensorInfo inputTensorInfo1({ 1, 2, 2, 2 }, ArmnnType, qScale, qOffset);
1891 auto input1 = QuantizedVector<T>(
1900 TensorInfo outputTensorInfo({ 1, 5, 2, 2 }, ArmnnType, qScale, qOffset);
1904 std::vector<T> output;
1905 output.resize(outputTensorInfo.GetNumElements());
1906 Concatenate<T>(workloadFactory,
1908 tensorHandleFactory,
1909 {inputTensorInfo0, inputTensorInfo1},
1910 {input0.data(), input1.data()},
1916 result.m_ActualData = output;
1917 result.m_ExpectedData = QuantizedVector<T>(
1935 template<DataType ArmnnType,
typename T = ResolveType<ArmnnType>>
1943 constexpr
unsigned int dimension = 2u;
1945 TensorInfo inputTensorInfo0({ 1, 3, 2, 2 }, ArmnnType, qScale, qOffset);
1946 auto input0 = QuantizedVector<T>(
1957 TensorInfo inputTensorInfo1({ 1, 3, 3, 2 }, ArmnnType, qScale, qOffset);
1958 auto input1 = QuantizedVector<T>(
1972 TensorInfo outputTensorInfo({ 1, 3, 5, 2 }, ArmnnType, qScale, qOffset);
1975 std::vector<T> output;
1976 output.resize(outputTensorInfo.GetNumElements());
1977 Concatenate<T>(workloadFactory,
1979 tensorHandleFactory,
1980 {inputTensorInfo0, inputTensorInfo1},
1981 {input0.data(), input1.data()},
1987 result.m_ActualData = output;
1988 result.m_ExpectedData = QuantizedVector<T>(
2013 template<DataType ArmnnType,
typename T = ResolveType<ArmnnType>>
2022 constexpr
unsigned int dimension = 3u;
2024 TensorInfo inputTensorInfo0({ 1, 3, 2, 2 }, ArmnnType, qScale, qOffset);
2025 auto input0 = QuantizedVector<T>(
2036 TensorInfo inputTensorInfo1({ 1, 3, 2, 3 }, ArmnnType, qScale, qOffset);
2037 auto input1 = QuantizedVector<T>(
2039 11.0f, 12.0f, 13.0f,
2040 14.0f, 15.0f, 16.0f,
2042 17.0f, 18.0f, 19.0f,
2043 20.0f, 21.0f, 22.0f,
2045 23.0f, 24.0f, 25.0f,
2050 TensorInfo outputTensorInfo({ 1, 3, 2, 5 }, ArmnnType, qScale, qOffset);
2054 std::vector<T> output;
2055 output.resize(outputTensorInfo.GetNumElements());
2056 Concatenate<T>(workloadFactory,
2058 tensorHandleFactory,
2059 {inputTensorInfo0, inputTensorInfo1},
2060 {input0.data(), input1.data()},
2066 result.m_ActualData = output;
2067 result.m_ExpectedData = QuantizedVector<T>(
2069 1.0f, 2.0f, 11.0f, 12.0f, 13.0f,
2070 3.0f, 4.0f, 14.0f, 15.0f, 16.0f,
2071 5.0f, 6.0f, 17.0f, 18.0f, 19.0f,
2072 7.0f, 8.0f, 20.0f, 21.0f, 22.0f,
2073 9.0f, 10.0f, 23.0f, 24.0f, 25.0f,
2074 11.0f, 12.0f, 26.0f, 27.0f, 28.0f
2081 template<DataType ArmnnType,
typename T>
2091 TensorInfo outputTensorInfo({ 3, 6, 3 }, ArmnnType);
2092 TensorInfo inputTensorInfo1({ 3, 6, 2 }, ArmnnType);
2093 TensorInfo inputTensorInfo2({ 3, 6, 1 }, ArmnnType);
2095 std::vector<TensorShape> inputTensorShapes({inputTensorInfo1.GetShape(), inputTensorInfo2.GetShape()});
2098 const float inputScale1 = 0.5f;
2099 const int32_t inputOffset1 = 5;
2101 std::vector<T> input1 =
2119 const float inputScale2 = 0.2f;
2120 const int32_t inputOffset2 = 10;
2122 std::vector<T> input2 =
2133 const float outputScale = 0.1f;
2134 const int32_t outputOffset = 20;
2136 std::vector<T> actualOutput(outputTensorInfo.GetNumElements());
2138 std::vector<T> expectedOutput =
2163 outputTensorInfo.SetQuantizationOffset(outputOffset);
2164 inputTensorInfo1.SetQuantizationScale(inputScale1);
2165 inputTensorInfo1.SetQuantizationOffset(inputOffset1);
2166 inputTensorInfo2.SetQuantizationScale(inputScale2);
2167 inputTensorInfo2.SetQuantizationOffset(inputOffset2);
2169 std::vector<unsigned int> wOrigin1 = { 0, 0, 0 };
2172 std::vector<unsigned int> wOrigin2 = { 0, 0, 2 };
2175 std::unique_ptr<ITensorHandle> outputHandle = tensorHandleFactory.
CreateTensorHandle(outputTensorInfo);
2179 std::unique_ptr<ITensorHandle> inputHandle1 =
2180 subTensorsSupported ?
2181 tensorHandleFactory.
CreateSubTensorHandle(*outputHandle, inputTensorInfo1.GetShape(), wOrigin1.data()) :
2184 std::unique_ptr<ITensorHandle> inputHandle2 =
2185 subTensorsSupported ?
2186 tensorHandleFactory.
CreateSubTensorHandle(*outputHandle, inputTensorInfo2.GetShape(), wOrigin2.data()) :
2191 inputTensorShapes.begin(),inputTensorShapes.end(), 2);
2195 AddInputToWorkload(data, info, inputTensorInfo1, inputHandle1.get());
2196 AddInputToWorkload(data, info, inputTensorInfo2, inputHandle2.get());
2197 AddOutputToWorkload(data, info, outputTensorInfo, outputHandle.get());
2204 inputHandle1->Allocate();
2205 inputHandle2->Allocate();
2206 outputHandle->Allocate();
2211 workload->PostAllocationConfigure();
2212 workload->Execute();
2218 outputHandle->GetShape(),
2219 outputTensorInfo.GetShape());
2227 ConcatDifferentInputOutputQParamTest<DataType::QAsymmU8>(
2234 ConcatDifferentInputOutputQParamTest<DataType::QSymmS16>(
2249 return ConcatTestImpl<DataType::Float32>(workloadFactory, memoryManager, tensorHandleFactory);
2257 return ConcatTestImpl<DataType::Signed32>(workloadFactory, memoryManager, tensorHandleFactory);
2265 return Concat1dTestImpl<DataType::Float32>(workloadFactory, memoryManager, tensorHandleFactory, 0.0f, 0);
2273 return Concat2dDim0TestImpl<DataType::Float32>(workloadFactory, memoryManager, tensorHandleFactory, 0.0f, 0);
2281 return Concat2dDim1TestImpl<DataType::Float32>(workloadFactory, memoryManager, tensorHandleFactory, 0.0f, 0);
2289 return Concat2dDim0DiffInputDimsTestImpl<DataType::Float32>(workloadFactory, memoryManager,
2290 tensorHandleFactory, 0.0f, 0);
2298 return Concat2dDim1DiffInputDimsTestImpl<DataType::Float32>(workloadFactory,
2300 tensorHandleFactory,
2310 return Concat3dDim0TestImpl<DataType::Float32>(workloadFactory, memoryManager, tensorHandleFactory, 0.0f, 0);
2318 return Concat3dDim1TestImpl<DataType::Float32>(workloadFactory, memoryManager, tensorHandleFactory, 0.0f, 0);
2327 return Concat3dDim2TestImpl<DataType::Float32>(workloadFactory, memoryManager, tensorHandleFactory,
2328 useSubtensor, 0.0f, 0);
2336 return Concat3dDim0DiffInputDimsTestImpl<DataType::Float32>(
2337 workloadFactory, memoryManager, tensorHandleFactory, 0.0f, 0);
2345 return Concat3dDim1DiffInputDimsTestImpl<DataType::Float32>(workloadFactory, memoryManager,
2346 tensorHandleFactory, 0.0f, 0);
2355 return Concat3dDim2DiffInputDimsTestImpl<DataType::Float32>(
2356 workloadFactory, memoryManager, tensorHandleFactory, useSubtensor, 0.0f, 0);
2364 return Concat4dDim0TestImpl<DataType::Float32>(workloadFactory, memoryManager, tensorHandleFactory, 0.0f, 0);
2372 return Concat4dDim1TestImpl<DataType::Float32>(workloadFactory, memoryManager, tensorHandleFactory, 0.0f, 0);
2380 return Concat4dDim2TestImpl<DataType::Float32>(workloadFactory, memoryManager, tensorHandleFactory, 0.0f, 0);
2389 return Concat4dDim3TestImpl<DataType::Float32>(workloadFactory, memoryManager,
2390 tensorHandleFactory, 0.0f, 0, useSubtensor);
2398 return Concat4dDiffShapeDim0TestImpl<DataType::Float32>(workloadFactory, memoryManager,
2399 tensorHandleFactory, 0.0f, 0);
2407 return Concat4dDiffShapeDim1TestImpl<DataType::Float32>(
2408 workloadFactory, memoryManager, tensorHandleFactory, 0.0f, 0);
2416 return Concat4dDiffShapeDim2TestImpl<DataType::Float32>(workloadFactory, memoryManager,
2417 tensorHandleFactory, 0.0f, 0);
2426 return Concat4dDiffShapeDim3TestImpl<DataType::Float32>(
2427 workloadFactory, memoryManager, tensorHandleFactory, 0.0f, 0, useSubtensor);
2435 return Concat3dDim1TestImpl<DataType::Float16>(workloadFactory, memoryManager, tensorHandleFactory, 0.0f, 0);
2443 return Concat3dDim1TestImpl<DataType::BFloat16>(workloadFactory, memoryManager, tensorHandleFactory, 0.0f, 0);
2453 unsigned int outputWidth = 3;
2454 unsigned int outputHeight = 6;
2455 unsigned int outputChannels = 3;
2457 unsigned int inputWidth1 = 3;
2458 unsigned int inputHeight1 = 6;
2459 unsigned int inputChannels1 = 2;
2461 unsigned int inputWidth2 = 3;
2462 unsigned int inputHeight2 = 6;
2463 unsigned int inputChannels2 = 1;
2471 const float inputScale1 = 0.015686f;
2472 const int32_t inputOffset1 = 192;
2474 std::vector<uint8_t> input1 =
2492 const float inputScale2 = 0.019608f;
2493 const int32_t inputOffset2 = 50;
2495 std::vector<uint8_t> input2 =
2507 const float outputScale = 0.015686f;
2508 const int32_t outputOffset = 192;
2510 std::vector<uint8_t> actualOutput(outputTensorInfo.GetNumElements());
2512 std::vector<uint8_t> expectedOutput =
2537 outputTensorInfo.SetQuantizationOffset(outputOffset);
2538 inputTensorInfo1.SetQuantizationScale(inputScale1);
2539 inputTensorInfo1.SetQuantizationOffset(inputOffset1);
2540 inputTensorInfo2.SetQuantizationScale(inputScale2);
2541 inputTensorInfo2.SetQuantizationOffset(inputOffset2);
2543 std::vector<unsigned int> wOrigin1 = { 0, 0, 0 };
2546 std::vector<unsigned int> wOrigin2 = { 2, 0, 0 };
2549 std::unique_ptr<ITensorHandle> outputHandle = tensorHandleFactory.
CreateTensorHandle(outputTensorInfo);
2553 std::unique_ptr<ITensorHandle> inputHandle1 =
2554 subTensorsSupported ?
2555 tensorHandleFactory.
CreateSubTensorHandle(*outputHandle, inputTensorInfo1.GetShape(), wOrigin1.data()) :
2558 std::unique_ptr<ITensorHandle> inputHandle2 =
2559 subTensorsSupported ?
2560 tensorHandleFactory.
CreateSubTensorHandle(*outputHandle, inputTensorInfo2.GetShape(), wOrigin2.data()) :
2565 AddInputToWorkload(data, info, inputTensorInfo1, inputHandle1.get());
2566 AddInputToWorkload(data, info, inputTensorInfo2, inputHandle2.get());
2567 AddOutputToWorkload(data, info, outputTensorInfo, outputHandle.get());
2574 inputHandle1->Allocate();
2575 inputHandle2->Allocate();
2576 outputHandle->Allocate();
2581 workload->PostAllocationConfigure();
2582 workload->Execute();
2588 outputHandle->GetShape(),
2589 outputTensorInfo.GetShape());
2599 unsigned int outputWidth = 3;
2600 unsigned int outputHeight = 6;
2601 unsigned int outputChannels = 3;
2603 unsigned int inputWidth1 = 3;
2604 unsigned int inputHeight1 = 6;
2605 unsigned int inputChannels1 = 2;
2607 unsigned int inputWidth2 = 3;
2608 unsigned int inputHeight2 = 6;
2609 unsigned int inputChannels2 = 1;
2617 const float scale = 0.13497836f;
2618 const int32_t offset = -7;
2621 outputTensorInfo.SetQuantizationOffset(offset);
2622 inputTensorInfo1.SetQuantizationScale(scale);
2623 inputTensorInfo1.SetQuantizationOffset(offset);
2624 inputTensorInfo2.SetQuantizationScale(scale);
2625 inputTensorInfo2.SetQuantizationOffset(offset);
2627 std::vector<uint8_t> actualOutput(outputTensorInfo.GetNumElements());
2629 std::vector<uint8_t> expectedOutput =
2653 std::vector<uint8_t> input1 =
2670 std::vector<uint8_t> input2 =
2680 std::vector<unsigned int> wOrigin1 = { 0, 0, 0 };
2683 std::vector<unsigned int> wOrigin2 = { 2, 0, 0 };
2686 std::unique_ptr<ITensorHandle> outputHandle = tensorHandleFactory.
CreateTensorHandle(outputTensorInfo);
2690 std::unique_ptr<ITensorHandle> inputHandle1 =
2691 subTensorsSupported ?
2692 tensorHandleFactory.
CreateSubTensorHandle(*outputHandle, inputTensorInfo1.GetShape(), wOrigin1.data()) :
2695 std::unique_ptr<ITensorHandle> inputHandle2 =
2696 subTensorsSupported ?
2697 tensorHandleFactory.
CreateSubTensorHandle(*outputHandle, inputTensorInfo2.GetShape(), wOrigin2.data()) :
2703 AddInputToWorkload(data, info, inputTensorInfo1, inputHandle1.get());
2704 AddInputToWorkload(data, info, inputTensorInfo2, inputHandle2.get());
2705 AddOutputToWorkload(data, info, outputTensorInfo, outputHandle.get());
2712 inputHandle1->Allocate();
2713 inputHandle2->Allocate();
2714 outputHandle->Allocate();
2719 workload->PostAllocationConfigure();
2720 workload->Execute();
2726 outputHandle->GetShape(),
2727 outputTensorInfo.GetShape());
2737 unsigned int outputWidth = 3;
2738 unsigned int outputHeight = 6;
2739 unsigned int outputChannels = 3;
2741 unsigned int inputWidth1 = 3;
2742 unsigned int inputHeight1 = 6;
2743 unsigned int inputChannels1 = 2;
2745 unsigned int inputWidth2 = 3;
2746 unsigned int inputHeight2 = 6;
2747 unsigned int inputChannels2 = 1;
2755 const float scale = 0.13497836f;
2756 const int32_t offset = -7;
2759 outputTensorInfo.SetQuantizationOffset(offset);
2760 inputTensorInfo1.SetQuantizationScale(scale);
2761 inputTensorInfo1.SetQuantizationOffset(offset);
2762 inputTensorInfo2.SetQuantizationScale(scale);
2763 inputTensorInfo2.SetQuantizationOffset(offset);
2765 std::vector<uint16_t> actualOutput(outputTensorInfo.GetNumElements());
2767 std::vector<uint16_t> expectedOutput =
2791 std::vector<uint16_t> input1 =
2808 std::vector<uint16_t> input2 =
2818 std::vector<unsigned int> wOrigin1 = { 0, 0, 0 };
2821 std::vector<unsigned int> wOrigin2 = { 2, 0, 0 };
2825 std::unique_ptr<ITensorHandle> outputHandle = tensorHandleFactory.
CreateTensorHandle(outputTensorInfo);
2829 std::unique_ptr<ITensorHandle> inputHandle1 =
2830 subTensorsSupported ?
2831 tensorHandleFactory.
CreateSubTensorHandle(*outputHandle, inputTensorInfo1.GetShape(), wOrigin1.data()) :
2834 std::unique_ptr<ITensorHandle> inputHandle2 =
2835 subTensorsSupported ?
2836 tensorHandleFactory.
CreateSubTensorHandle(*outputHandle, inputTensorInfo2.GetShape(), wOrigin2.data()) :
2842 AddInputToWorkload(data, info, inputTensorInfo1, inputHandle1.get());
2843 AddInputToWorkload(data, info, inputTensorInfo2, inputHandle2.get());
2844 AddOutputToWorkload(data, info, outputTensorInfo, outputHandle.get());
2851 inputHandle1->Allocate();
2852 inputHandle2->Allocate();
2853 outputHandle->Allocate();
2858 workload->PostAllocationConfigure();
2859 workload->Execute();
2865 outputHandle->GetShape(),
2866 outputTensorInfo.GetShape());
2874 return Concat1dTestImpl<DataType::QAsymmU8>(workloadFactory, memoryManager, tensorHandleFactory, 0.5f, -1);
2882 return Concat2dDim0TestImpl<DataType::QAsymmU8>(workloadFactory, memoryManager, tensorHandleFactory, 0.5f, -1);
2890 return Concat2dDim1TestImpl<DataType::QAsymmU8>(workloadFactory, memoryManager, tensorHandleFactory, 0.5f, -1);
2898 return Concat2dDim0DiffInputDimsTestImpl<DataType::QAsymmU8>(
2899 workloadFactory, memoryManager, tensorHandleFactory, 0.5f, -1);
2907 return Concat2dDim1DiffInputDimsTestImpl<DataType::QAsymmU8>(
2908 workloadFactory, memoryManager, tensorHandleFactory, 0.5f, -1);
2916 return Concat3dDim0TestImpl<DataType::QAsymmU8>(workloadFactory, memoryManager, tensorHandleFactory, 0.5f, -1);
2924 return Concat3dDim1TestImpl<DataType::QAsymmU8>(workloadFactory, memoryManager, tensorHandleFactory, 0.5f, -1);
2933 return Concat3dDim2TestImpl<DataType::QAsymmU8>(
2934 workloadFactory, memoryManager, tensorHandleFactory, useSubtensor, 0.5f, -1);
2942 return Concat3dDim0TestImpl<DataType::QAsymmU8>(workloadFactory, memoryManager, tensorHandleFactory, 0.5f, -1);
2950 return Concat3dDim1DiffInputDimsTestImpl<DataType::QAsymmU8>(
2951 workloadFactory, memoryManager, tensorHandleFactory, 0.5f, -1);
2960 return Concat3dDim2DiffInputDimsTestImpl<DataType::QAsymmU8>(
2961 workloadFactory, memoryManager, tensorHandleFactory, useSubtensor, 0.5f, -1);
2969 return Concat4dDim0TestImpl<DataType::QAsymmU8>(workloadFactory, memoryManager, tensorHandleFactory, 0.5f, -1);
2977 return Concat4dDim1TestImpl<DataType::QAsymmU8>(workloadFactory, memoryManager, tensorHandleFactory, 0.5f, -1);
2985 return Concat4dDim2TestImpl<DataType::QAsymmU8>(workloadFactory, memoryManager, tensorHandleFactory, 0.5f, -1);
2993 return Concat4dDim3TestImpl<DataType::QAsymmU8>(
2994 workloadFactory, memoryManager, tensorHandleFactory, 0.5f, -1, useSubtensor);
3002 return Concat4dDiffShapeDim0TestImpl<DataType::QAsymmU8>(
3003 workloadFactory, memoryManager, tensorHandleFactory, 0.5f, -1);
3011 return Concat4dDiffShapeDim1TestImpl<DataType::QAsymmU8>(
3012 workloadFactory, memoryManager, tensorHandleFactory, 0.5f, -1);
3020 return Concat4dDiffShapeDim2TestImpl<DataType::QAsymmU8>(
3021 workloadFactory, memoryManager, tensorHandleFactory, 0.5f, -1);
3030 return Concat4dDiffShapeDim3TestImpl<DataType::QAsymmU8>(
3031 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)
LayerTestResult< int32_t, 3 > ConcatInt32Test(IWorkloadFactory &workloadFactory, const IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory)
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)
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)
std::vector< T > m_ExpectedData
void CopyDataFromITensorHandle(void *mem, const armnn::ITensorHandle *tensorHandle)
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)
LayerTestResult< uint8_t, 3 > Concat3dDim1Uint8Test(IWorkloadFactory &workloadFactory, const IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory)
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)
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)
void CopyDataToITensorHandle(armnn::ITensorHandle *tensorHandle, const void *memory)
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 TensorInfos of 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)
virtual std::unique_ptr< IWorkload > CreateWorkload(LayerType type, const QueueDescriptor &descriptor, const WorkloadInfo &info) const
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)
LayerTestResult< T, 3 > ConcatTestImpl(IWorkloadFactory &workloadFactory, const IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory)
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.
LayerTestResult< T, 4 > Concat4dDiffShapeDim0TestImpl(IWorkloadFactory &workloadFactory, const IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory, float qScale, int32_t qOffset)
virtual bool SupportsSubTensors() const =0