ArmNN
 21.02
RefLayerSupportTests.cpp File Reference

Go to the source code of this file.

Functions

 BOOST_AUTO_TEST_CASE (IsLayerSupportedLayerTypeMatches)
 
 BOOST_AUTO_TEST_CASE (IsLayerSupportedReferenceAddition)
 
 BOOST_AUTO_TEST_CASE (IsLayerSupportedBFloat16Reference)
 
 BOOST_AUTO_TEST_CASE (IsLayerSupportedFloat16Reference)
 
 BOOST_AUTO_TEST_CASE (IsLayerSupportedFloat32Reference)
 
 BOOST_AUTO_TEST_CASE (IsLayerSupportedUint8Reference)
 
 BOOST_AUTO_TEST_CASE (IsLayerSupportedInt8Reference)
 
 BOOST_AUTO_TEST_CASE (IsLayerSupportedInt16Reference)
 
 BOOST_AUTO_TEST_CASE (IsConvertFp16ToFp32SupportedReference)
 
 BOOST_AUTO_TEST_CASE (IsConvertFp16ToFp32SupportedFp32InputReference)
 
 BOOST_AUTO_TEST_CASE (IsConvertFp16ToFp32SupportedFp16OutputReference)
 
 BOOST_AUTO_TEST_CASE (IsConvertBf16ToFp32SupportedReference)
 
 BOOST_AUTO_TEST_CASE (IsConvertBf16ToFp32SupportedFp32InputReference)
 
 BOOST_AUTO_TEST_CASE (IsConvertBf16ToFp32SupportedBf16OutputReference)
 
 BOOST_AUTO_TEST_CASE (IsConvertFp32ToBf16SupportedReference)
 
 BOOST_AUTO_TEST_CASE (IsConvertFp32ToBf16SupportedBf16InputReference)
 
 BOOST_AUTO_TEST_CASE (IsConvertFp32ToBf16SupportedFp32OutputReference)
 
 BOOST_AUTO_TEST_CASE (IsConvertFp32ToFp16SupportedReference)
 
 BOOST_AUTO_TEST_CASE (IsConvertFp32ToFp16SupportedFp16InputReference)
 
 BOOST_AUTO_TEST_CASE (IsConvertFp32ToFp16SupportedFp32OutputReference)
 
 BOOST_AUTO_TEST_CASE (IsLayerSupportedMeanDimensionsReference)
 
 BOOST_AUTO_TEST_CASE (IsLayerNotSupportedMeanDimensionsReference)
 
 BOOST_AUTO_TEST_CASE (IsConstantSupportedRef)
 

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/23]

BOOST_AUTO_TEST_CASE ( IsLayerSupportedLayerTypeMatches  )

Definition at line 32 of file RefLayerSupportTests.cpp.

33 {
34  LayerTypeMatchesTest();
35 }

◆ BOOST_AUTO_TEST_CASE() [2/23]

BOOST_AUTO_TEST_CASE ( IsLayerSupportedReferenceAddition  )

Definition at line 36 of file RefLayerSupportTests.cpp.

References armnn::Float32, and RefLayerSupport::IsAdditionSupported().

37 {
38  armnn::TensorShape shape0 = {1,1,3,4};
39  armnn::TensorShape shape1 = {4};
40  armnn::TensorShape outShape = {1,1,3,4};
44 
45  armnn::RefLayerSupport supportChecker;
46  std::string reasonNotSupported;
47  BOOST_CHECK(supportChecker.IsAdditionSupported(in0, in1, out, reasonNotSupported));
48 }
bool IsAdditionSupported(const TensorInfo &input0, const TensorInfo &input1, const TensorInfo &output, Optional< std::string &> reasonIfUnsupported=EmptyOptional()) const override

◆ BOOST_AUTO_TEST_CASE() [3/23]

BOOST_AUTO_TEST_CASE ( IsLayerSupportedBFloat16Reference  )

Definition at line 50 of file RefLayerSupportTests.cpp.

51 {
53  IsLayerSupportedTests<armnn::RefWorkloadFactory, armnn::DataType::BFloat16>(&factory);
54 }

◆ BOOST_AUTO_TEST_CASE() [4/23]

BOOST_AUTO_TEST_CASE ( IsLayerSupportedFloat16Reference  )

Definition at line 56 of file RefLayerSupportTests.cpp.

57 {
59  IsLayerSupportedTests<armnn::RefWorkloadFactory, armnn::DataType::Float16>(&factory);
60 }

◆ BOOST_AUTO_TEST_CASE() [5/23]

BOOST_AUTO_TEST_CASE ( IsLayerSupportedFloat32Reference  )

Definition at line 62 of file RefLayerSupportTests.cpp.

63 {
65  IsLayerSupportedTests<armnn::RefWorkloadFactory, armnn::DataType::Float32>(&factory);
66 }

◆ BOOST_AUTO_TEST_CASE() [6/23]

BOOST_AUTO_TEST_CASE ( IsLayerSupportedUint8Reference  )

Definition at line 68 of file RefLayerSupportTests.cpp.

69 {
71  IsLayerSupportedTests<armnn::RefWorkloadFactory, armnn::DataType::QAsymmU8>(&factory);
72 }

◆ BOOST_AUTO_TEST_CASE() [7/23]

BOOST_AUTO_TEST_CASE ( IsLayerSupportedInt8Reference  )

Definition at line 74 of file RefLayerSupportTests.cpp.

75 {
77  IsLayerSupportedTests<armnn::RefWorkloadFactory, armnn::DataType::QSymmS8>(&factory);
78 }

◆ BOOST_AUTO_TEST_CASE() [8/23]

BOOST_AUTO_TEST_CASE ( IsLayerSupportedInt16Reference  )

Definition at line 80 of file RefLayerSupportTests.cpp.

81 {
83  IsLayerSupportedTests<armnn::RefWorkloadFactory, armnn::DataType::QSymmS16>(&factory);
84 }

◆ BOOST_AUTO_TEST_CASE() [9/23]

BOOST_AUTO_TEST_CASE ( IsConvertFp16ToFp32SupportedReference  )

Definition at line 86 of file RefLayerSupportTests.cpp.

References armnn::Float16, and armnn::Float32.

87 {
88  std::string reasonIfUnsupported;
89 
90  bool result = IsConvertLayerSupportedTests<armnn::RefWorkloadFactory, armnn::ConvertFp16ToFp32Layer,
92 
93  BOOST_CHECK(result);
94 }
This layer converts data type Float 16 to Float 32.

◆ BOOST_AUTO_TEST_CASE() [10/23]

BOOST_AUTO_TEST_CASE ( IsConvertFp16ToFp32SupportedFp32InputReference  )

Definition at line 96 of file RefLayerSupportTests.cpp.

References armnn::Float32.

97 {
98  std::string reasonIfUnsupported;
99 
100  bool result = IsConvertLayerSupportedTests<armnn::RefWorkloadFactory, armnn::ConvertFp16ToFp32Layer,
101  armnn::DataType::Float32, armnn::DataType::Float32>(reasonIfUnsupported);
102 
103  BOOST_CHECK(!result);
104  BOOST_CHECK_EQUAL(reasonIfUnsupported, "Layer is not supported with float32 data type input");
105 }
This layer converts data type Float 16 to Float 32.

◆ BOOST_AUTO_TEST_CASE() [11/23]

BOOST_AUTO_TEST_CASE ( IsConvertFp16ToFp32SupportedFp16OutputReference  )

Definition at line 107 of file RefLayerSupportTests.cpp.

References armnn::Float16.

108 {
109  std::string reasonIfUnsupported;
110 
111  bool result = IsConvertLayerSupportedTests<armnn::RefWorkloadFactory, armnn::ConvertFp16ToFp32Layer,
112  armnn::DataType::Float16, armnn::DataType::Float16>(reasonIfUnsupported);
113 
114  BOOST_CHECK(!result);
115  BOOST_CHECK_EQUAL(reasonIfUnsupported, "Layer is not supported with float16 data type output");
116 }
This layer converts data type Float 16 to Float 32.

◆ BOOST_AUTO_TEST_CASE() [12/23]

BOOST_AUTO_TEST_CASE ( IsConvertBf16ToFp32SupportedReference  )

Definition at line 118 of file RefLayerSupportTests.cpp.

References armnn::BFloat16, and armnn::Float32.

119 {
120  std::string reasonIfUnsupported;
121 
122  bool result = IsConvertLayerSupportedTests<armnn::RefWorkloadFactory, armnn::ConvertBf16ToFp32Layer,
124 
125  BOOST_CHECK(result);
126 }
This layer converts data type BFloat16 to Float32.

◆ BOOST_AUTO_TEST_CASE() [13/23]

BOOST_AUTO_TEST_CASE ( IsConvertBf16ToFp32SupportedFp32InputReference  )

Definition at line 128 of file RefLayerSupportTests.cpp.

References armnn::Float32.

129 {
130  std::string reasonIfUnsupported;
131 
132  bool result = IsConvertLayerSupportedTests<armnn::RefWorkloadFactory, armnn::ConvertBf16ToFp32Layer,
133  armnn::DataType::Float32, armnn::DataType::Float32>(reasonIfUnsupported);
134 
135  BOOST_CHECK(!result);
136  BOOST_CHECK_EQUAL(reasonIfUnsupported, "Reference for ConvertBf16ToFp32 layer: input type not supported\n");
137 }
This layer converts data type BFloat16 to Float32.

◆ BOOST_AUTO_TEST_CASE() [14/23]

BOOST_AUTO_TEST_CASE ( IsConvertBf16ToFp32SupportedBf16OutputReference  )

Definition at line 139 of file RefLayerSupportTests.cpp.

References armnn::BFloat16.

140 {
141  std::string reasonIfUnsupported;
142 
143  bool result = IsConvertLayerSupportedTests<armnn::RefWorkloadFactory, armnn::ConvertBf16ToFp32Layer,
144  armnn::DataType::BFloat16, armnn::DataType::BFloat16>(reasonIfUnsupported);
145 
146  BOOST_CHECK(!result);
147  BOOST_CHECK_EQUAL(reasonIfUnsupported, "Reference for ConvertBf16ToFp32 layer: output type not supported\n");
148 }
This layer converts data type BFloat16 to Float32.

◆ BOOST_AUTO_TEST_CASE() [15/23]

BOOST_AUTO_TEST_CASE ( IsConvertFp32ToBf16SupportedReference  )

Definition at line 150 of file RefLayerSupportTests.cpp.

References armnn::BFloat16, and armnn::Float32.

151 {
152  std::string reasonIfUnsupported;
153 
154  bool result = IsConvertLayerSupportedTests<armnn::RefWorkloadFactory, armnn::ConvertFp32ToBf16Layer,
156 
157  BOOST_CHECK(result);
158 }
This layer converts data type Float32 to BFloat16.

◆ BOOST_AUTO_TEST_CASE() [16/23]

BOOST_AUTO_TEST_CASE ( IsConvertFp32ToBf16SupportedBf16InputReference  )

Definition at line 160 of file RefLayerSupportTests.cpp.

References armnn::BFloat16.

161 {
162  std::string reasonIfUnsupported;
163 
164  bool result = IsConvertLayerSupportedTests<armnn::RefWorkloadFactory, armnn::ConvertFp32ToBf16Layer,
165  armnn::DataType::BFloat16, armnn::DataType::BFloat16>(reasonIfUnsupported);
166 
167  BOOST_CHECK(!result);
168  BOOST_CHECK_EQUAL(reasonIfUnsupported, "Reference for ConvertFp32ToBf16 layer: input type not supported\n");
169 }
This layer converts data type Float32 to BFloat16.

◆ BOOST_AUTO_TEST_CASE() [17/23]

BOOST_AUTO_TEST_CASE ( IsConvertFp32ToBf16SupportedFp32OutputReference  )

Definition at line 171 of file RefLayerSupportTests.cpp.

References armnn::Float32.

172 {
173  std::string reasonIfUnsupported;
174 
175  bool result = IsConvertLayerSupportedTests<armnn::RefWorkloadFactory, armnn::ConvertFp32ToBf16Layer,
176  armnn::DataType::Float32, armnn::DataType::Float32>(reasonIfUnsupported);
177 
178  BOOST_CHECK(!result);
179  BOOST_CHECK_EQUAL(reasonIfUnsupported, "Reference for ConvertFp32ToBf16 layer: output type not supported\n");
180 }
This layer converts data type Float32 to BFloat16.

◆ BOOST_AUTO_TEST_CASE() [18/23]

BOOST_AUTO_TEST_CASE ( IsConvertFp32ToFp16SupportedReference  )

Definition at line 182 of file RefLayerSupportTests.cpp.

References armnn::Float16, and armnn::Float32.

183 {
184  std::string reasonIfUnsupported;
185 
186  bool result = IsConvertLayerSupportedTests<armnn::RefWorkloadFactory, armnn::ConvertFp32ToFp16Layer,
187  armnn::DataType::Float32, armnn::DataType::Float16>(reasonIfUnsupported);
188 
189  BOOST_CHECK(result);
190 }
This layer converts data type Float 32 to Float 16.

◆ BOOST_AUTO_TEST_CASE() [19/23]

BOOST_AUTO_TEST_CASE ( IsConvertFp32ToFp16SupportedFp16InputReference  )

Definition at line 192 of file RefLayerSupportTests.cpp.

References armnn::Float16.

193 {
194  std::string reasonIfUnsupported;
195 
196  bool result = IsConvertLayerSupportedTests<armnn::RefWorkloadFactory, armnn::ConvertFp32ToFp16Layer,
197  armnn::DataType::Float16, armnn::DataType::Float16>(reasonIfUnsupported);
198 
199  BOOST_CHECK(!result);
200  BOOST_CHECK_EQUAL(reasonIfUnsupported, "Layer is not supported with float16 data type input");
201 }
This layer converts data type Float 32 to Float 16.

◆ BOOST_AUTO_TEST_CASE() [20/23]

BOOST_AUTO_TEST_CASE ( IsConvertFp32ToFp16SupportedFp32OutputReference  )

Definition at line 203 of file RefLayerSupportTests.cpp.

References armnn::Float32.

204 {
205  std::string reasonIfUnsupported;
206 
207  bool result = IsConvertLayerSupportedTests<armnn::RefWorkloadFactory, armnn::ConvertFp32ToFp16Layer,
208  armnn::DataType::Float32, armnn::DataType::Float32>(reasonIfUnsupported);
209 
210  BOOST_CHECK(!result);
211  BOOST_CHECK_EQUAL(reasonIfUnsupported, "Layer is not supported with float32 data type output");
212 }
This layer converts data type Float 32 to Float 16.

◆ BOOST_AUTO_TEST_CASE() [21/23]

BOOST_AUTO_TEST_CASE ( IsLayerSupportedMeanDimensionsReference  )

Definition at line 214 of file RefLayerSupportTests.cpp.

References armnn::Float32.

215 {
216  std::string reasonIfUnsupported;
217 
218  bool result = IsMeanLayerSupportedTests<armnn::RefWorkloadFactory,
219  armnn::DataType::Float32, armnn::DataType::Float32>(reasonIfUnsupported);
220 
221  BOOST_CHECK(result);
222 }

◆ BOOST_AUTO_TEST_CASE() [22/23]

BOOST_AUTO_TEST_CASE ( IsLayerNotSupportedMeanDimensionsReference  )

Definition at line 224 of file RefLayerSupportTests.cpp.

References armnn::Float32.

225 {
226  std::string reasonIfUnsupported;
227 
228  bool result = IsMeanLayerNotSupportedTests<armnn::RefWorkloadFactory,
229  armnn::DataType::Float32, armnn::DataType::Float32>(reasonIfUnsupported);
230 
231  BOOST_CHECK(!result);
232 
233  BOOST_CHECK(reasonIfUnsupported.find(
234  "Reference Mean: Expected 4 dimensions but got 2 dimensions instead, for the 'output' tensor.")
235  != std::string::npos);
236 }

◆ BOOST_AUTO_TEST_CASE() [23/23]

BOOST_AUTO_TEST_CASE ( IsConstantSupportedRef  )

Definition at line 238 of file RefLayerSupportTests.cpp.

References armnn::BFloat16, armnn::Boolean, BOOST_AUTO_TEST_SUITE_END(), armnn::Float16, armnn::Float32, armnn::QAsymmS8, armnn::QAsymmU8, armnn::QSymmS16, and armnn::QSymmS8.

239 {
240  std::string reasonIfUnsupported;
241 
242  bool result = IsConstantLayerSupportedTests<armnn::RefWorkloadFactory,
243  armnn::DataType::Float16>(reasonIfUnsupported);
244  BOOST_CHECK(result);
245 
246  result = IsConstantLayerSupportedTests<armnn::RefWorkloadFactory,
247  armnn::DataType::Float32>(reasonIfUnsupported);
248  BOOST_CHECK(result);
249 
250  result = IsConstantLayerSupportedTests<armnn::RefWorkloadFactory,
251  armnn::DataType::QAsymmU8>(reasonIfUnsupported);
252  BOOST_CHECK(result);
253 
254  result = IsConstantLayerSupportedTests<armnn::RefWorkloadFactory,
255  armnn::DataType::Boolean>(reasonIfUnsupported);
256  BOOST_CHECK(!result);
257 
258  result = IsConstantLayerSupportedTests<armnn::RefWorkloadFactory,
259  armnn::DataType::QSymmS16>(reasonIfUnsupported);
260  BOOST_CHECK(result);
261 
262  result = IsConstantLayerSupportedTests<armnn::RefWorkloadFactory,
263  armnn::DataType::QSymmS8>(reasonIfUnsupported);
264  BOOST_CHECK(result);
265 
266  result = IsConstantLayerSupportedTests<armnn::RefWorkloadFactory,
267  armnn::DataType::QAsymmS8>(reasonIfUnsupported);
268  BOOST_CHECK(result);
269 
270  result = IsConstantLayerSupportedTests<armnn::RefWorkloadFactory,
271  armnn::DataType::BFloat16>(reasonIfUnsupported);
272  BOOST_CHECK(result);
273 }