ArmNN
 20.08
ReshapeTestImpl.hpp File Reference

Go to the source code of this file.

Functions

template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
LayerTestResult< T, 4 > SimpleReshapeTest (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
 
template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
LayerTestResult< T, 5 > Reshape5dTest (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 111 of file ReshapeTestImpl.cpp.

References TensorInfo::SetQuantizationScale().

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

◆ SimpleReshapeTest()

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

Definition at line 59 of file ReshapeTestImpl.cpp.

References TensorInfo::SetQuantizationScale().

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