ArmNN  NotReleased
ReshapeTestImpl.cpp File Reference

Go to the source code of this file.

Functions

template<armnn::DataType ArmnnType, typename T >
LayerTestResult< T, 4 > SimpleReshapeTest (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
 
template<armnn::DataType ArmnnType, typename T >
LayerTestResult< T, 5 > Reshape5dTest (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
 
template LayerTestResult< armnn::ResolveType< armnn::DataType::Float32 >, 4 > SimpleReshapeTest< armnn::DataType::Float32 > (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
 
template LayerTestResult< armnn::ResolveType< armnn::DataType::QAsymmU8 >, 4 > SimpleReshapeTest< armnn::DataType::QAsymmU8 > (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
 
template LayerTestResult< armnn::ResolveType< armnn::DataType::QSymmS16 >, 4 > SimpleReshapeTest< armnn::DataType::QSymmS16 > (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
 
template LayerTestResult< armnn::ResolveType< armnn::DataType::Float32 >, 5 > Reshape5dTest< armnn::DataType::Float32 > (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
 
template LayerTestResult< armnn::ResolveType< armnn::DataType::QAsymmU8 >, 5 > Reshape5dTest< armnn::DataType::QAsymmU8 > (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
 
template LayerTestResult< armnn::ResolveType< armnn::DataType::QSymmS16 >, 5 > Reshape5dTest< armnn::DataType::QSymmS16 > (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
 

Function Documentation

◆ Reshape5dTest()

LayerTestResult<T, 5> Reshape5dTest ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager 
)

Definition at line 109 of file ReshapeTestImpl.cpp.

References TensorInfo::SetQuantizationScale().

112 {
113  armnn::TensorInfo inputTensorInfo;
114  armnn::TensorInfo outputTensorInfo;
115 
116  unsigned int inputShape[] = { 2, 2, 8, 1, 1 };
117  unsigned int outputShape[] = { 2, 2, 2, 2, 2 };
118 
119  inputTensorInfo = armnn::TensorInfo(5, inputShape, ArmnnType);
120  inputTensorInfo.SetQuantizationScale(1.0f);
121  outputTensorInfo = armnn::TensorInfo(5, outputShape, ArmnnType);
122  outputTensorInfo.SetQuantizationScale(1.0f);
123 
124  auto input = ConvertToDataType<ArmnnType>(
125  {
126  0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f,
127  8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f,
128 
129  16.0f, 17.0f, 18.0f, 19.0f, 20.0f, 21.0f, 22.0f, 23.0f,
130  24.0f, 25.0f, 26.0f, 27.0f, 28.0f, 29.0f, 30.0f, 31.0f,
131  },
132  inputTensorInfo);
133 
134  auto outputExpected = ConvertToDataType<ArmnnType>(
135  {
136  0.0f, 1.0f,
137  2.0f, 3.0f,
138 
139  4.0f, 5.0f,
140  6.0f, 7.0f,
141 
142 
143  8.0f, 9.0f,
144  10.0f, 11.0f,
145 
146  12.0f, 13.0f,
147  14.0f, 15.0f,
148 
149 
150 
151  16.0f, 17.0f,
152  18.0f, 19.0f,
153 
154  20.0f, 21.0f,
155  22.0f, 23.0f,
156 
157 
158  24.0f, 25.0f,
159  26.0f, 27.0f,
160 
161  28.0f, 29.0f,
162  30.0f, 31.0f,
163  },
164  outputTensorInfo);
165 
166  return SimpleReshapeTestImpl<T, 5>(
167  workloadFactory, memoryManager, inputTensorInfo, outputTensorInfo, input, outputExpected);
168 }
void SetQuantizationScale(float scale)
Definition: Tensor.cpp:259

◆ Reshape5dTest< armnn::DataType::Float32 >()

◆ Reshape5dTest< armnn::DataType::QAsymmU8 >()

◆ Reshape5dTest< armnn::DataType::QSymmS16 >()

◆ SimpleReshapeTest()

LayerTestResult<T, 4> SimpleReshapeTest ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager 
)

Definition at line 57 of file ReshapeTestImpl.cpp.

References TensorInfo::SetQuantizationScale().

60 {
61  armnn::TensorInfo inputTensorInfo;
62  armnn::TensorInfo outputTensorInfo;
63 
64  unsigned int inputShape[] = { 2, 2, 3, 3 };
65  unsigned int outputShape[] = { 2, 2, 9, 1 };
66 
67  inputTensorInfo = armnn::TensorInfo(4, inputShape, ArmnnType);
68  inputTensorInfo.SetQuantizationScale(1.0f);
69  outputTensorInfo = armnn::TensorInfo(4, outputShape, ArmnnType);
70  outputTensorInfo.SetQuantizationScale(1.0f);
71 
72  auto input = ConvertToDataType<ArmnnType>(
73  {
74  0.0f, 1.0f, 2.0f,
75  3.0f, 4.0f, 5.0f,
76  6.0f, 7.0f, 8.0f,
77 
78  9.0f, 10.0f, 11.0f,
79  12.0f, 13.0f, 14.0f,
80  15.0f, 16.0f, 17.0f,
81 
82  18.0f, 19.0f, 20.0f,
83  21.0f, 22.0f, 23.0f,
84  24.0f, 25.0f, 26.0f,
85 
86  27.0f, 28.0f, 29.0f,
87  30.0f, 31.0f, 32.0f,
88  33.0f, 34.0f, 35.0f,
89  },
90  inputTensorInfo);
91 
92  auto outputExpected = ConvertToDataType<ArmnnType>(
93  {
94  0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f,
95 
96  9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 16.0f, 17.0f,
97 
98  18.0f, 19.0f, 20.0f, 21.0f, 22.0f, 23.0f, 24.0f, 25.0f, 26.0f,
99 
100  27.0f, 28.0f, 29.0f, 30.0f, 31.0f, 32.0f, 33.0f, 34.0f, 35.0f,
101  },
102  outputTensorInfo);
103 
104  return SimpleReshapeTestImpl<T, 4>(
105  workloadFactory, memoryManager, inputTensorInfo, outputTensorInfo, input, outputExpected);
106 }
void SetQuantizationScale(float scale)
Definition: Tensor.cpp:259

◆ SimpleReshapeTest< armnn::DataType::Float32 >()

◆ SimpleReshapeTest< armnn::DataType::QAsymmU8 >()

◆ SimpleReshapeTest< armnn::DataType::QSymmS16 >()