23 template<armnn::DataType ArmnnType,
typename T, std::
size_t outputDimLength>
30 const std::vector<std::vector<T>>& inputData,
31 const std::vector<T>& outputExpectedData)
33 boost::ignore_unused(memoryManager);
34 unsigned int numInputs =
static_cast<unsigned int>(inputData.size());
35 std::vector<boost::multi_array<T, outputDimLength-1>> inputs;
36 for (
unsigned int i = 0; i < numInputs; ++i)
38 inputs.push_back(MakeTensor<T, outputDimLength-1>(inputTensorInfo, inputData[i]));
42 result.outputExpected = MakeTensor<T, outputDimLength>(outputTensorInfo, outputExpectedData);
44 std::vector<std::unique_ptr<armnn::ITensorHandle>> inputHandles;
45 for (
unsigned int i = 0; i < numInputs; ++i)
49 std::unique_ptr<armnn::ITensorHandle> outputHandle = workloadFactory.
CreateTensorHandle(outputTensorInfo);
57 for (
unsigned int i = 0; i < numInputs; ++i)
59 std::unique_ptr<armnn::ITensorHandle>& inputHandle = inputHandles[i];
60 AddInputToWorkload(descriptor, info, inputTensorInfo, inputHandle.get());
61 inputHandle->Allocate();
65 AddOutputToWorkload(descriptor, info, outputTensorInfo, outputHandle.get());
66 outputHandle->Allocate();
68 std::unique_ptr<armnn::IWorkload> workload = workloadFactory.
CreateStack(descriptor, info);
83 template<armnn::DataType ArmnnType,
typename T = armnn::ResolveType<ArmnnType>>
91 std::vector<std::vector<T>> inputData;
117 std::vector<T> outputExpectedData =
139 return StackTestHelper<ArmnnType, T, 4>(
150 template<armnn::DataType ArmnnType,
typename T = armnn::ResolveType<ArmnnType>>
158 std::vector<std::vector<T>> inputData;
184 std::vector<T> outputExpectedData =
207 return StackTestHelper<ArmnnType, T, 4>(
218 template<armnn::DataType ArmnnType,
typename T = armnn::ResolveType<ArmnnType>>
226 std::vector<std::vector<T>> inputData;
252 std::vector<T> outputExpectedData =
273 return StackTestHelper<ArmnnType, T, 4>(
284 template<armnn::DataType ArmnnType,
typename T = armnn::ResolveType<ArmnnType>>
292 std::vector<std::vector<T>> inputData;
318 std::vector<T> outputExpectedData =
347 return StackTestHelper<ArmnnType, T, 4>(
358 template<armnn::DataType ArmnnType,
typename T = armnn::ResolveType<ArmnnType>>
366 std::vector<std::vector<T>> inputData;
389 std::vector<T> outputExpectedData =
404 return StackTestHelper<ArmnnType, T, 3>(
415 template<armnn::DataType ArmnnType,
typename T = armnn::ResolveType<ArmnnType>>
423 std::vector<std::vector<T>> inputData;
457 std::vector<T> outputExpectedData =
489 return StackTestHelper<ArmnnType, T, 5>(
508 return StackAxis0TestImpl<armnn::DataType::Float32>(workloadFactory, memoryManager);
515 return StackOutput4DAxis1TestImpl<armnn::DataType::Float32>(workloadFactory, memoryManager);
522 return StackOutput4DAxis2TestImpl<armnn::DataType::Float32>(workloadFactory, memoryManager);
529 return StackOutput4DAxis3TestImpl<armnn::DataType::Float32>(workloadFactory, memoryManager);
536 return StackOutput3DInputs3TestImpl<armnn::DataType::Float32>(workloadFactory, memoryManager);
543 return StackOutput5DTestImpl<armnn::DataType::Float32>(workloadFactory, memoryManager);
550 using namespace half_float::literal;
555 std::vector<std::vector<armnn::Half>> inputData;
563 10.0_h, 11.0_h, 12.0_h,
565 13.0_h, 14.0_h, 15.0_h,
566 16.0_h, 17.0_h, 18.0_h
571 19.0_h, 20.0_h, 21.0_h,
572 22.0_h, 23.0_h, 24.0_h,
574 25.0_h, 26.0_h, 27.0_h,
575 28.0_h, 29.0_h, 30.0_h,
577 31.0_h, 32.0_h, 33.0_h,
578 34.0_h, 35.0_h, 36.0_h
581 std::vector<armnn::Half> outputExpectedData =
584 19.0_h, 20.0_h, 21.0_h,
587 22.0_h, 23.0_h, 24.0_h,
590 25.0_h, 26.0_h, 27.0_h,
592 10.0_h, 11.0_h, 12.0_h,
593 28.0_h, 29.0_h, 30.0_h,
595 13.0_h, 14.0_h, 15.0_h,
596 31.0_h, 32.0_h, 33.0_h,
598 16.0_h, 17.0_h, 18.0_h,
599 34.0_h, 35.0_h, 36.0_h
602 return StackTestHelper<armnn::DataType::Float16, armnn::Half, 4>(
uint32_t m_Axis
0-based axis along which to stack the input tensors.
void CopyDataToITensorHandle(armnn::ITensorHandle *tensorHandle, const void *memory)
LayerDescriptor m_Parameters
virtual std::unique_ptr< ITensorHandle > CreateTensorHandle(const TensorInfo &tensorInfo, const bool IsMemoryManaged=true) const =0
LayerTestResult< float, 5 > StackOutput5DFloat32Test(armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
TensorShape m_InputShape
Required shape of all input tensors.
virtual std::unique_ptr< IWorkload > CreateStack(const StackQueueDescriptor &descriptor, const WorkloadInfo &info) const
void CopyDataFromITensorHandle(void *memory, const armnn::ITensorHandle *tensorHandle)
std::shared_ptr< IMemoryManager > IMemoryManagerSharedPtr
LayerTestResult< float, 4 > StackOutput4DAxis3Float32Test(armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
LayerTestResult< T, 4 > StackAxis0TestImpl(armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
LayerTestResult< T, 5 > StackOutput5DTestImpl(armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
uint32_t m_NumInputs
Number of input tensors.
LayerTestResult< float, 3 > StackOutput3DInputs3Float32Test(armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
LayerTestResult< float, 4 > StackAxis0Float32Test(armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
LayerTestResult< float, 4 > StackOutput4DAxis1Float32Test(armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
LayerTestResult< float, 4 > StackOutput4DAxis2Float32Test(armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
LayerTestResult< T, 4 > StackOutput4DAxis1TestImpl(armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
LayerTestResult< T, 4 > StackOutput4DAxis2TestImpl(armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
LayerTestResult< T, 3 > StackOutput3DInputs3TestImpl(armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
LayerTestResult< armnn::Half, 4 > StackFloat16Test(armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
const TensorShape & GetShape() const
LayerTestResult< T, 4 > StackOutput4DAxis3TestImpl(armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)