19 template<
typename FactoryType,
typename T>
26 const std::vector<T>& inputData,
27 const std::vector<T>& outputExpectedData)
29 auto input = MakeTensor<T, 4>(inputTensorInfo, inputData);
32 ret.outputExpected = MakeTensor<T, 4>(outputTensorInfo, outputExpectedData);
34 auto tensorHandleFactory = WorkloadFactoryHelper<FactoryType>::GetTensorHandleFactory(memoryManager);
35 std::unique_ptr<armnn::ITensorHandle> inputHandle = tensorHandleFactory.CreateTensorHandle(inputTensorInfo);
36 std::unique_ptr<armnn::ITensorHandle> outputHandle = tensorHandleFactory.CreateTensorHandle(outputTensorInfo);
41 AddInputToWorkload(data, info, inputTensorInfo, inputHandle.get());
42 AddOutputToWorkload(data, info, outputTensorInfo, outputHandle.get());
44 std::unique_ptr<armnn::IWorkload> workload = workloadFactory.
CreateTranspose(data, info);
46 inputHandle->Allocate();
47 outputHandle->Allocate();
58 template<
typename FactoryType, armnn::DataType ArmnnType,
typename T = armnn::ResolveType<ArmnnType>>
66 unsigned int inputShape[] = { 1, 2, 2, 2 };
67 unsigned int outputShape[] = { 1, 2, 2, 2 };
78 if(armnn::IsQuantizedType<T>())
86 std::vector<T> input = armnnUtils::QuantizedVector<T>(
95 std::vector<T> outputExpected = armnnUtils::QuantizedVector<T>(
102 return SimpleTransposeTestImpl<FactoryType, T>(workloadFactory, memoryManager,
103 descriptor, inputTensorInfo,
104 outputTensorInfo, input, outputExpected);
107 template<
typename FactoryType, armnn::DataType ArmnnType,
typename T = armnn::ResolveType<ArmnnType>>
115 unsigned int inputShape[] = { 1, 2, 2, 3 };
116 unsigned int outputShape[] = { 1, 3, 2, 2 };
127 if(armnn::IsQuantizedType<T>())
135 std::vector<T> input = armnnUtils::QuantizedVector<T>(
144 std::vector<T> outputExpected = armnnUtils::QuantizedVector<T>(
152 return SimpleTransposeTestImpl<FactoryType, T>(workloadFactory, memoryManager,
153 descriptor, inputTensorInfo,
154 outputTensorInfo, input, outputExpected);
157 template<
typename FactoryType, armnn::DataType ArmnnType,
typename T = armnn::ResolveType<ArmnnType>>
165 unsigned int inputShape[] = { 1, 3, 2, 2 };
166 unsigned int outputShape[] = { 1, 2, 2, 3 };
177 if(armnn::IsQuantizedType<T>())
185 std::vector<T> input = armnnUtils::QuantizedVector<T>(
193 std::vector<T> outputExpected = armnnUtils::QuantizedVector<T>(
202 return SimpleTransposeTestImpl<FactoryType, T>(workloadFactory, memoryManager,
203 descriptor, inputTensorInfo,
204 outputTensorInfo, input, outputExpected);
207 template<
typename FactoryType, armnn::DataType ArmnnType,
typename T = armnn::ResolveType<ArmnnType>>
215 unsigned int inputShape[] = { 1, 2, 3, 3 };
216 unsigned int outputShape[] = { 1, 3, 2, 3 };
227 if(armnn::IsQuantizedType<T>())
235 std::vector<T> input = armnnUtils::QuantizedVector<T>(
246 std::vector<T> outputExpected = armnnUtils::QuantizedVector<T>(
248 1, 11, 21, 31, 41, 51,
249 2, 12, 22, 32, 42, 52,
250 3, 13, 23, 33, 43, 53
254 return SimpleTransposeTestImpl<FactoryType, T>(workloadFactory, memoryManager,
255 descriptor, inputTensorInfo,
256 outputTensorInfo, input, outputExpected);
LayerTestResult< T, 4 > TransposeValueSet2Test(armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
LayerTestResult< T, 4 > TransposeValueSet1Test(armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
LayerTestResult< T, 4 > TransposeValueSet3Test(armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
virtual std::unique_ptr< IWorkload > CreateTranspose(const TransposeQueueDescriptor &descriptor, const WorkloadInfo &info) const
LayerDescriptor m_Parameters
LayerTestResult< T, 4 > SimpleTransposeTest(armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
std::shared_ptr< IMemoryManager > IMemoryManagerSharedPtr
LayerTestResult< T, 4 > SimpleTransposeTestImpl(armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager, armnn::TransposeDescriptor descriptor, armnn::TensorInfo inputTensorInfo, armnn::TensorInfo outputTensorInfo, const std::vector< T > &inputData, const std::vector< T > &outputExpectedData)
void SetQuantizationScale(float scale)
void CopyDataFromITensorHandle(void *memory, const armnn::ITensorHandle *tensorHandle)
A TransposeDescriptor for the TransposeLayer.
Contains information about inputs and outputs to a layer.
void SetQuantizationOffset(int32_t offset)
PermutationVector m_DimMappings
Indicates how to translate tensor elements from a given source into the target destination, when source and target potentially have different memory layouts e.g.
void CopyDataToITensorHandle(armnn::ITensorHandle *tensorHandle, const void *memory)