ArmNN  NotReleased
RefLayerSupportTests.cpp File Reference
#include <layers/ConvertFp16ToFp32Layer.hpp>
#include <layers/ConvertFp32ToFp16Layer.hpp>
#include <test/TensorHelpers.hpp>
#include <backendsCommon/CpuTensorHandle.hpp>
#include <reference/RefWorkloadFactory.hpp>
#include <reference/RefLayerSupport.hpp>
#include <backendsCommon/test/LayerTests.hpp>
#include <backendsCommon/test/IsLayerSupportedTestImpl.hpp>
#include <boost/test/unit_test.hpp>
#include <boost/algorithm/string/trim.hpp>
#include <string>

Go to the source code of this file.

Functions

 BOOST_AUTO_TEST_CASE (IsLayerSupportedLayerTypeMatches)
 
 BOOST_AUTO_TEST_CASE (IsLayerSupportedReferenceAddition)
 
 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 (IsConvertFp32ToFp16SupportedReference)
 
 BOOST_AUTO_TEST_CASE (IsConvertFp32ToFp16SupportedFp16InputReference)
 
 BOOST_AUTO_TEST_CASE (IsConvertFp32ToFp16SupportedFp32OutputReference)
 
 BOOST_AUTO_TEST_CASE (IsLayerSupportedMeanDimensionsReference)
 
 BOOST_AUTO_TEST_CASE (IsLayerNotSupportedMeanDimensionsReference)
 

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/15]

BOOST_AUTO_TEST_CASE ( IsLayerSupportedLayerTypeMatches  )

Definition at line 33 of file RefLayerSupportTests.cpp.

34 {
35  LayerTypeMatchesTest();
36 }

◆ BOOST_AUTO_TEST_CASE() [2/15]

BOOST_AUTO_TEST_CASE ( IsLayerSupportedReferenceAddition  )

Definition at line 37 of file RefLayerSupportTests.cpp.

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

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

◆ BOOST_AUTO_TEST_CASE() [3/15]

BOOST_AUTO_TEST_CASE ( IsLayerSupportedFloat16Reference  )

Definition at line 51 of file RefLayerSupportTests.cpp.

52 {
54  IsLayerSupportedTests<armnn::RefWorkloadFactory, armnn::DataType::Float16>(&factory);
55 }

◆ BOOST_AUTO_TEST_CASE() [4/15]

BOOST_AUTO_TEST_CASE ( IsLayerSupportedFloat32Reference  )

Definition at line 57 of file RefLayerSupportTests.cpp.

58 {
60  IsLayerSupportedTests<armnn::RefWorkloadFactory, armnn::DataType::Float32>(&factory);
61 }

◆ BOOST_AUTO_TEST_CASE() [5/15]

BOOST_AUTO_TEST_CASE ( IsLayerSupportedUint8Reference  )

Definition at line 63 of file RefLayerSupportTests.cpp.

64 {
66  IsLayerSupportedTests<armnn::RefWorkloadFactory, armnn::DataType::QAsymmU8>(&factory);
67 }

◆ BOOST_AUTO_TEST_CASE() [6/15]

BOOST_AUTO_TEST_CASE ( IsLayerSupportedInt8Reference  )

Definition at line 69 of file RefLayerSupportTests.cpp.

70 {
72  IsLayerSupportedTests<armnn::RefWorkloadFactory, armnn::DataType::QSymmS8>(&factory);
73 }

◆ BOOST_AUTO_TEST_CASE() [7/15]

BOOST_AUTO_TEST_CASE ( IsLayerSupportedInt16Reference  )

Definition at line 75 of file RefLayerSupportTests.cpp.

76 {
78  IsLayerSupportedTests<armnn::RefWorkloadFactory, armnn::DataType::QSymmS16>(&factory);
79 }

◆ BOOST_AUTO_TEST_CASE() [8/15]

BOOST_AUTO_TEST_CASE ( IsConvertFp16ToFp32SupportedReference  )

Definition at line 81 of file RefLayerSupportTests.cpp.

References BOOST_CHECK(), armnn::Float16, and armnn::Float32.

82 {
83  std::string reasonIfUnsupported;
84 
85  bool result = IsConvertLayerSupportedTests<armnn::RefWorkloadFactory, armnn::ConvertFp16ToFp32Layer,
87 
88  BOOST_CHECK(result);
89 }
BOOST_CHECK(profilingService.GetCurrentState()==ProfilingState::WaitingForAck)
This layer converts data type Float 16 to Float 32.

◆ BOOST_AUTO_TEST_CASE() [9/15]

BOOST_AUTO_TEST_CASE ( IsConvertFp16ToFp32SupportedFp32InputReference  )

Definition at line 91 of file RefLayerSupportTests.cpp.

References BOOST_CHECK(), and armnn::Float32.

92 {
93  std::string reasonIfUnsupported;
94 
95  bool result = IsConvertLayerSupportedTests<armnn::RefWorkloadFactory, armnn::ConvertFp16ToFp32Layer,
96  armnn::DataType::Float32, armnn::DataType::Float32>(reasonIfUnsupported);
97 
98  BOOST_CHECK(!result);
99  BOOST_CHECK_EQUAL(reasonIfUnsupported, "Layer is not supported with float32 data type input");
100 }
BOOST_CHECK(profilingService.GetCurrentState()==ProfilingState::WaitingForAck)
This layer converts data type Float 16 to Float 32.

◆ BOOST_AUTO_TEST_CASE() [10/15]

BOOST_AUTO_TEST_CASE ( IsConvertFp16ToFp32SupportedFp16OutputReference  )

Definition at line 102 of file RefLayerSupportTests.cpp.

References BOOST_CHECK(), and armnn::Float16.

103 {
104  std::string reasonIfUnsupported;
105 
106  bool result = IsConvertLayerSupportedTests<armnn::RefWorkloadFactory, armnn::ConvertFp16ToFp32Layer,
107  armnn::DataType::Float16, armnn::DataType::Float16>(reasonIfUnsupported);
108 
109  BOOST_CHECK(!result);
110  BOOST_CHECK_EQUAL(reasonIfUnsupported, "Layer is not supported with float16 data type output");
111 }
BOOST_CHECK(profilingService.GetCurrentState()==ProfilingState::WaitingForAck)
This layer converts data type Float 16 to Float 32.

◆ BOOST_AUTO_TEST_CASE() [11/15]

BOOST_AUTO_TEST_CASE ( IsConvertFp32ToFp16SupportedReference  )

Definition at line 113 of file RefLayerSupportTests.cpp.

References BOOST_CHECK(), armnn::Float16, and armnn::Float32.

114 {
115  std::string reasonIfUnsupported;
116 
117  bool result = IsConvertLayerSupportedTests<armnn::RefWorkloadFactory, armnn::ConvertFp32ToFp16Layer,
118  armnn::DataType::Float32, armnn::DataType::Float16>(reasonIfUnsupported);
119 
120  BOOST_CHECK(result);
121 }
This layer converts data type Float 32 to Float 16.
BOOST_CHECK(profilingService.GetCurrentState()==ProfilingState::WaitingForAck)

◆ BOOST_AUTO_TEST_CASE() [12/15]

BOOST_AUTO_TEST_CASE ( IsConvertFp32ToFp16SupportedFp16InputReference  )

Definition at line 123 of file RefLayerSupportTests.cpp.

References BOOST_CHECK(), and armnn::Float16.

124 {
125  std::string reasonIfUnsupported;
126 
127  bool result = IsConvertLayerSupportedTests<armnn::RefWorkloadFactory, armnn::ConvertFp32ToFp16Layer,
128  armnn::DataType::Float16, armnn::DataType::Float16>(reasonIfUnsupported);
129 
130  BOOST_CHECK(!result);
131  BOOST_CHECK_EQUAL(reasonIfUnsupported, "Layer is not supported with float16 data type input");
132 }
This layer converts data type Float 32 to Float 16.
BOOST_CHECK(profilingService.GetCurrentState()==ProfilingState::WaitingForAck)

◆ BOOST_AUTO_TEST_CASE() [13/15]

BOOST_AUTO_TEST_CASE ( IsConvertFp32ToFp16SupportedFp32OutputReference  )

Definition at line 134 of file RefLayerSupportTests.cpp.

References BOOST_CHECK(), and armnn::Float32.

135 {
136  std::string reasonIfUnsupported;
137 
138  bool result = IsConvertLayerSupportedTests<armnn::RefWorkloadFactory, armnn::ConvertFp32ToFp16Layer,
139  armnn::DataType::Float32, armnn::DataType::Float32>(reasonIfUnsupported);
140 
141  BOOST_CHECK(!result);
142  BOOST_CHECK_EQUAL(reasonIfUnsupported, "Layer is not supported with float32 data type output");
143 }
This layer converts data type Float 32 to Float 16.
BOOST_CHECK(profilingService.GetCurrentState()==ProfilingState::WaitingForAck)

◆ BOOST_AUTO_TEST_CASE() [14/15]

BOOST_AUTO_TEST_CASE ( IsLayerSupportedMeanDimensionsReference  )

Definition at line 145 of file RefLayerSupportTests.cpp.

References BOOST_CHECK(), and armnn::Float32.

146 {
147  std::string reasonIfUnsupported;
148 
149  bool result = IsMeanLayerSupportedTests<armnn::RefWorkloadFactory,
150  armnn::DataType::Float32, armnn::DataType::Float32>(reasonIfUnsupported);
151 
152  BOOST_CHECK(result);
153 }
BOOST_CHECK(profilingService.GetCurrentState()==ProfilingState::WaitingForAck)

◆ BOOST_AUTO_TEST_CASE() [15/15]

BOOST_AUTO_TEST_CASE ( IsLayerNotSupportedMeanDimensionsReference  )

Definition at line 155 of file RefLayerSupportTests.cpp.

References BOOST_AUTO_TEST_SUITE_END(), BOOST_CHECK(), and armnn::Float32.

156 {
157  std::string reasonIfUnsupported;
158 
159  bool result = IsMeanLayerNotSupportedTests<armnn::RefWorkloadFactory,
160  armnn::DataType::Float32, armnn::DataType::Float32>(reasonIfUnsupported);
161 
162  BOOST_CHECK(!result);
163 
164  boost::algorithm::trim(reasonIfUnsupported);
165  BOOST_CHECK_EQUAL(reasonIfUnsupported,
166  "Reference Mean: Expected 4 dimensions but got 2 dimensions instead, for the 'output' tensor.");
167 }
BOOST_CHECK(profilingService.GetCurrentState()==ProfilingState::WaitingForAck)