ArmNN  NotReleased
ActivationTestImpl.hpp File Reference

Go to the source code of this file.

Functions

LayerTestResult< float, 4 > SimpleSigmoidTest (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
 
LayerTestResult< uint8_t, 4 > SimpleSigmoidUint8Test (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
 
LayerTestResult< int16_t, 4 > SimpleSigmoidInt16Test (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
 
LayerTestResult< float, 4 > TanhTest (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
 
LayerTestResult< uint8_t, 4 > TanhUint8Test (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
 
LayerTestResult< int16_t, 4 > TanhInt16Test (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
 
LayerTestResult< float, 4 > ConstantLinearActivationTest (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
 
LayerTestResult< uint8_t, 4 > ConstantLinearActivationUint8Test (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
 
LayerTestResult< int16_t, 4 > ConstantLinearActivationInt16Test (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
 
LayerTestResult< float, 4 > ReLuTest (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
 
LayerTestResult< uint8_t, 4 > ReLuUint8Test (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
 
LayerTestResult< int16_t, 4 > ReLuInt16Test (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
 
LayerTestResult< uint8_t, 4 > BoundedReLuUint8Test (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager, float upperBound)
 
LayerTestResult< uint8_t, 4 > BoundedReLuUint8Test (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager, float upperBound, float lowerBound)
 
LayerTestResult< int16_t, 4 > BoundedReLuInt16Test (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
 
LayerTestResult< float, 4 > BoundedReLuUpperAndLowerBoundTest (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
 
LayerTestResult< uint8_t, 4 > BoundedReLuUint8UpperAndLowerBoundTest (armnn::IWorkloadFactory &workloadFactor, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManagery)
 
LayerTestResult< float, 4 > BoundedReLuUpperBoundOnlyTest (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
 
LayerTestResult< uint8_t, 4 > BoundedReLuUint8UpperBoundOnlyTest (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
 
LayerTestResult< float, 4 > CompareBoundedReLuTest (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager, armnn::IWorkloadFactory &refWorkloadFactory, float upperBound, float lowerBound)
 
LayerTestResult< float, 4 > SoftReLuTest (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
 
LayerTestResult< uint8_t, 4 > SoftReLuUint8Test (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
 
LayerTestResult< int16_t, 4 > SoftReLuInt16Test (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
 
LayerTestResult< float, 4 > LeakyReLuTest (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
 
LayerTestResult< uint8_t, 4 > LeakyReLuUint8Test (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
 
LayerTestResult< int16_t, 4 > LeakyReLuInt16Test (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
 
LayerTestResult< float, 4 > AbsTest (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
 
LayerTestResult< uint8_t, 4 > AbsUint8Test (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
 
LayerTestResult< int16_t, 4 > AbsInt16Test (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
 
LayerTestResult< float, 4 > SqrtTest (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
 
LayerTestResult< float, 5 > SqrtNNTest (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
 
LayerTestResult< uint8_t, 4 > SqrtUint8Test (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
 
LayerTestResult< int16_t, 4 > SqrtInt16Test (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
 
LayerTestResult< float, 4 > SquareTest (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
 
LayerTestResult< uint8_t, 4 > SquareUint8Test (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
 
LayerTestResult< int16_t, 4 > SquareInt16Test (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
 
LayerTestResult< float, 4 > CompareActivationTest (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager, armnn::IWorkloadFactory &refWorkloadFactory, armnn::ActivationFunction f, unsigned int batchSize)
 
LayerTestResult< uint8_t, 4 > CompareActivationUint8Test (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager, armnn::IWorkloadFactory &refWorkloadFactory, armnn::ActivationFunction f)
 
LayerTestResult< int16_t, 4 > CompareActivationInt16Test (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager, armnn::IWorkloadFactory &refWorkloadFactory, armnn::ActivationFunction f)
 

Function Documentation

◆ AbsInt16Test()

LayerTestResult<int16_t, 4> AbsInt16Test ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager 
)

Definition at line 785 of file ActivationTestImpl.cpp.

788 {
789  return AbsTestCommon<armnn::DataType::QSymmS16>(workloadFactory, memoryManager, 0.1f, 0);
790 }

◆ AbsTest()

LayerTestResult<float, 4> AbsTest ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager 
)

Definition at line 771 of file ActivationTestImpl.cpp.

774 {
775  return AbsTestCommon<armnn::DataType::Float32>(workloadFactory, memoryManager, 0.1f, 0);
776 }

◆ AbsUint8Test()

LayerTestResult<uint8_t, 4> AbsUint8Test ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager 
)

Definition at line 778 of file ActivationTestImpl.cpp.

781 {
782  return AbsTestCommon<armnn::DataType::QAsymmU8>(workloadFactory, memoryManager, 0.0625f, 64);
783 }

◆ BoundedReLuInt16Test()

LayerTestResult<int16_t, 4> BoundedReLuInt16Test ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager 
)

Definition at line 614 of file ActivationTestImpl.cpp.

617 {
618  return ReLuTestCommon<armnn::DataType::QSymmS16>(workloadFactory, memoryManager, 0.1f, 0);
619 }

◆ BoundedReLuUint8Test() [1/2]

LayerTestResult<uint8_t, 4> BoundedReLuUint8Test ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager,
float  upperBound 
)

◆ BoundedReLuUint8Test() [2/2]

LayerTestResult<uint8_t, 4> BoundedReLuUint8Test ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager,
float  upperBound,
float  lowerBound 
)

◆ BoundedReLuUint8UpperAndLowerBoundTest()

LayerTestResult<uint8_t, 4> BoundedReLuUint8UpperAndLowerBoundTest ( armnn::IWorkloadFactory workloadFactor,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManagery 
)

Definition at line 184 of file ActivationTestImpl.cpp.

References CopyDataFromITensorHandle(), CopyDataToITensorHandle(), IWorkloadFactory::CreateActivation(), IWorkloadFactory::CreateTensorHandle(), armnn::Float32, armnn::GetInputTensorInfo(), and QueueDescriptorWithParameters< LayerDescriptor >::m_Parameters.

187 {
188  unsigned int inputWidth = 3u;
189  unsigned int inputHeight = 2u;
190  unsigned int inputChannels = 1u;
191  unsigned int inputBatchSize = 1;
192 
193  std::vector<uint8_t> input = std::vector<uint8_t>{
194  51, 230, 28,
195  251, 8, 92
196  };
197 
198  // Calculated manually.
199  std::vector<uint8_t> output = std::vector<uint8_t>{
200  51, 192, 32,
201  192, 32, 92
202  };
203 
204  int32_t inputOffset = 112;
205  float inputScale = 0.0125f;
206 
207  return BoundedReLuTestCommon<armnn::DataType::QAsymmU8>(
208  workloadFactory, memoryManager, 1.0f, -1.0f,
209  inputScale, inputOffset, inputScale, inputOffset, // Input/output scale & offset same.
210  input, output, inputWidth, inputHeight, inputChannels, inputBatchSize);
211 }

◆ BoundedReLuUint8UpperBoundOnlyTest()

LayerTestResult<uint8_t, 4> BoundedReLuUint8UpperBoundOnlyTest ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager 
)

Definition at line 153 of file ActivationTestImpl.cpp.

156 {
157  unsigned int inputWidth = 3u;
158  unsigned int inputHeight = 2u;
159  unsigned int inputChannels = 1u;
160  unsigned int inputBatchSize = 1;
161 
162  std::vector<uint8_t> input = std::vector<uint8_t>{
163  51, 124, 28,
164  251, 8, 92
165  };
166 
167  // Calculated manually.
168  std::vector<uint8_t> output = std::vector<uint8_t>{
169  0, 122, 0,
170  255, 0, 58
171  };
172 
173  float inputScale = 12.0f / 255.0f;
174  int32_t inputOffset = 63;
175  float outputScale = 6.0f / 255.0f;
176  int32_t outputOffset = 0;
177 
178  return BoundedReLuTestCommon<armnn::DataType::QAsymmU8>(
179  workloadFactory, memoryManager, 6.0f, 0.0f,
180  inputScale, inputOffset, outputScale, outputOffset,
181  input, output, inputWidth, inputHeight, inputChannels, inputBatchSize);
182 }

◆ BoundedReLuUpperAndLowerBoundTest()

LayerTestResult<float, 4> BoundedReLuUpperAndLowerBoundTest ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager 
)

Definition at line 91 of file ActivationTestImpl.cpp.

94 {
95  unsigned int inputWidth = 4u;
96  unsigned int inputHeight = 5u;
97  unsigned int inputChannels = 1u;
98  unsigned int inputBatchSize = 1;
99 
100  std::vector<float> input = std::vector<float>{
101  -2.0f, 0.1f, 0.5f, 1.25f,
102  0.786f, 0.9875f, -1.5f, 0.384f,
103  1.0001f, 3.5f, 7.5f, 0.896f,
104  2.126f, 2.0f, 0.3f, 0.15f,
105  0.999f, 1.2f, 0.89f, 6.1f,
106  };
107 
108  // Calculated manually.
109  std::vector<float> output = std::vector<float>{
110  -1.0f, 0.1f, 0.5f, 1.0f,
111  0.786f, 0.9875f, -1.0f, 0.384f,
112  1.0f, 1.0f, 1.0f, 0.896f,
113  1.0f, 1.0f, 0.3f, 0.15f,
114  0.999f, 1.0f, 0.89f, 1.0f,
115  };
116 
117  return BoundedReLuTestCommon<armnn::DataType::Float32>(
118  workloadFactory, memoryManager, 1.0f, -1.0f, 1.0f, 0, 1.0f, 0, input, output,
119  inputWidth, inputHeight, inputChannels, inputBatchSize);
120 }

◆ BoundedReLuUpperBoundOnlyTest()

LayerTestResult<float, 4> BoundedReLuUpperBoundOnlyTest ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager 
)

Definition at line 122 of file ActivationTestImpl.cpp.

125 {
126  unsigned int inputWidth = 4u;
127  unsigned int inputHeight = 5u;
128  unsigned int inputChannels = 1u;
129  unsigned int inputBatchSize = 1;
130 
131  std::vector<float> input = std::vector<float>{
132  -1.0f, 0.1f, 0.5f, 6.25f,
133  0.786f, 5.9875f, -0.5f, 0.384f,
134  6.0001f, 3.5f, 7.5f, 0.896f,
135  2.126f, 12.0f, 0.3f, 0.15f,
136  0.999f, 1.2f, 0.89f, 6.1f,
137  };
138 
139  // Calculated manually.
140  std::vector<float> output = std::vector<float>{
141  0.0f, 0.1f, 0.5f, 6.0f,
142  0.786f, 5.9875f, 0.0f, 0.384f,
143  6.0f, 3.5f, 6.0f, 0.896f,
144  2.126f, 6.0f, 0.3f, 0.15f,
145  0.999f, 1.2f, 0.89f, 6.0f,
146  };
147 
148  return BoundedReLuTestCommon<armnn::DataType::Float32>(
149  workloadFactory, memoryManager, 6.0f, 0.0f, 1.0f, 0, 1.0f, 0, input, output,
150  inputWidth, inputHeight, inputChannels, inputBatchSize);
151 }

◆ CompareActivationInt16Test()

LayerTestResult<int16_t, 4> CompareActivationInt16Test ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager,
armnn::IWorkloadFactory refWorkloadFactory,
armnn::ActivationFunction  f 
)

Definition at line 1136 of file ActivationTestImpl.cpp.

1141 {
1142  return CompareActivationTestImpl<armnn::DataType::QSymmS16>(
1143  workloadFactory, memoryManager, refWorkloadFactory, f, 5, 0.1f, 0);
1144 }

◆ CompareActivationTest()

LayerTestResult<float, 4> CompareActivationTest ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager,
armnn::IWorkloadFactory refWorkloadFactory,
armnn::ActivationFunction  f,
unsigned int  batchSize 
)

Definition at line 1115 of file ActivationTestImpl.cpp.

1121 {
1122  return CompareActivationTestImpl<armnn::DataType::Float32>(
1123  workloadFactory, memoryManager, refWorkloadFactory, f, batchSize);
1124 }

◆ CompareActivationUint8Test()

LayerTestResult<uint8_t, 4> CompareActivationUint8Test ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager,
armnn::IWorkloadFactory refWorkloadFactory,
armnn::ActivationFunction  f 
)

Definition at line 1126 of file ActivationTestImpl.cpp.

1131 {
1132  return CompareActivationTestImpl<armnn::DataType::QAsymmU8>(
1133  workloadFactory, memoryManager, refWorkloadFactory, f, 5, 0.1f, 50);
1134 }

◆ CompareBoundedReLuTest()

LayerTestResult<float, 4> CompareBoundedReLuTest ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager,
armnn::IWorkloadFactory refWorkloadFactory,
float  upperBound,
float  lowerBound 
)

Definition at line 284 of file ActivationTestImpl.cpp.

References armnn::BoundedReLu, ActivationDescriptor::m_A, ActivationDescriptor::m_B, ActivationDescriptor::m_Function, LayerTestResult< T, n >::output, and LayerTestResult< T, n >::outputExpected.

290 {
291  LayerTestResult<float, 4> result(BoundedReLuRandomInputTestTraits::GetOutputTensorInfo());
292 
293  armnn::ActivationDescriptor activationDescriptor;
294  activationDescriptor.m_Function = armnn::ActivationFunction::BoundedReLu;
295  activationDescriptor.m_A = upperBound;
296  activationDescriptor.m_B = lowerBound;
297 
298  result.output = BoundedReLuRandomInputTest(
299  workloadFactory, memoryManager, 0.0f, upperBound, activationDescriptor);
300  result.outputExpected = BoundedReLuRandomInputTest(
301  refWorkloadFactory, nullptr, 0.0f, upperBound, activationDescriptor);
302 
303  return result;
304 }
float m_A
Alpha upper bound value used by the activation functions. (BoundedReLu, Linear, TanH).
Definition: Descriptors.hpp:37
An ActivationDescriptor for the ActivationLayer.
Definition: Descriptors.hpp:20
float m_B
Beta lower bound value used by the activation functions. (BoundedReLu, Linear, TanH).
Definition: Descriptors.hpp:39
ActivationFunction m_Function
The activation function to use (Sigmoid, TanH, Linear, ReLu, BoundedReLu, SoftReLu, LeakyReLu, Abs, Sqrt, Square).
Definition: Descriptors.hpp:35

◆ ConstantLinearActivationInt16Test()

LayerTestResult<int16_t, 4> ConstantLinearActivationInt16Test ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager 
)

Definition at line 383 of file ActivationTestImpl.cpp.

386 {
387  return ConstantLinearActivationTestCommon<armnn::DataType::QSymmS16>(
388  workloadFactory, memoryManager, 0.1f, 0);
389 }

◆ ConstantLinearActivationTest()

LayerTestResult<float, 4> ConstantLinearActivationTest ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager 
)

Definition at line 368 of file ActivationTestImpl.cpp.

371 {
372  return ConstantLinearActivationTestCommon<armnn::DataType::Float32>(workloadFactory, memoryManager);
373 }

◆ ConstantLinearActivationUint8Test()

LayerTestResult<uint8_t, 4> ConstantLinearActivationUint8Test ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager 
)

Definition at line 375 of file ActivationTestImpl.cpp.

378 {
379  return ConstantLinearActivationTestCommon<armnn::DataType::QAsymmU8>(
380  workloadFactory, memoryManager, 4.0f, 3);
381 }

◆ LeakyReLuInt16Test()

LayerTestResult<int16_t, 4> LeakyReLuInt16Test ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager 
)

Definition at line 729 of file ActivationTestImpl.cpp.

732 {
733  return LeakyReLuTestCommon<armnn::DataType::QSymmS16>(workloadFactory, memoryManager, 0.1f, 0);
734 }

◆ LeakyReLuTest()

LayerTestResult<float, 4> LeakyReLuTest ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager 
)

Definition at line 715 of file ActivationTestImpl.cpp.

718 {
719  return LeakyReLuTestCommon<armnn::DataType::Float32>(workloadFactory, memoryManager, 0.1f, 0);
720 }

◆ LeakyReLuUint8Test()

LayerTestResult<uint8_t, 4> LeakyReLuUint8Test ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager 
)

Definition at line 722 of file ActivationTestImpl.cpp.

725 {
726  return LeakyReLuTestCommon<armnn::DataType::QAsymmU8>(workloadFactory, memoryManager, 0.0625f, 64);
727 }

◆ ReLuInt16Test()

LayerTestResult<int16_t, 4> ReLuInt16Test ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager 
)

Definition at line 555 of file ActivationTestImpl.cpp.

558 {
559  return ReLuTestCommon<armnn::DataType::QSymmS16>(workloadFactory, memoryManager, 0.1f, 0);
560 }

◆ ReLuTest()

LayerTestResult<float, 4> ReLuTest ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager 
)

Definition at line 570 of file ActivationTestImpl.cpp.

573 {
574  return ReLuTestCommon<armnn::DataType::Float32>(workloadFactory, memoryManager, 0.1f, 0);
575 }

◆ ReLuUint8Test()

LayerTestResult<uint8_t, 4> ReLuUint8Test ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager 
)

Definition at line 563 of file ActivationTestImpl.cpp.

566 {
567  return ReLuTestCommon<armnn::DataType::QAsymmU8>(workloadFactory, memoryManager, 0.1f, 0);
568 }

◆ SimpleSigmoidInt16Test()

LayerTestResult<int16_t, 4> SimpleSigmoidInt16Test ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager 
)

Definition at line 513 of file ActivationTestImpl.cpp.

516 {
517  return SimpleSigmoidTestCommon<armnn::DataType::QSymmS16>(workloadFactory, memoryManager, 0.1f, 0);
518 }

◆ SimpleSigmoidTest()

LayerTestResult<float, 4> SimpleSigmoidTest ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager 
)

Definition at line 499 of file ActivationTestImpl.cpp.

502 {
503  return SimpleSigmoidTestCommon<armnn::DataType::Float32>(workloadFactory, memoryManager, 0.0f, 0);
504 }

◆ SimpleSigmoidUint8Test()

LayerTestResult<uint8_t, 4> SimpleSigmoidUint8Test ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager 
)

Definition at line 506 of file ActivationTestImpl.cpp.

509 {
510  return SimpleSigmoidTestCommon<armnn::DataType::QAsymmU8>(workloadFactory, memoryManager, 0.1f, 50);
511 }

◆ SoftReLuInt16Test()

LayerTestResult<int16_t, 4> SoftReLuInt16Test ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager 
)

Definition at line 672 of file ActivationTestImpl.cpp.

675 {
676  return SoftReLuTestCommon<armnn::DataType::QSymmS16>(workloadFactory, memoryManager, 0.1f, 0);
677 }

◆ SoftReLuTest()

LayerTestResult<float, 4> SoftReLuTest ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager 
)

Definition at line 658 of file ActivationTestImpl.cpp.

661 {
662  return SoftReLuTestCommon<armnn::DataType::Float32>(workloadFactory, memoryManager, 0.1f, 0);
663 }

◆ SoftReLuUint8Test()

LayerTestResult<uint8_t, 4> SoftReLuUint8Test ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager 
)

Definition at line 665 of file ActivationTestImpl.cpp.

668 {
669  return SoftReLuTestCommon<armnn::DataType::QAsymmU8>(workloadFactory, memoryManager, 0.0625f, 64);
670 }

◆ SqrtInt16Test()

LayerTestResult<int16_t, 4> SqrtInt16Test ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager 
)

Definition at line 897 of file ActivationTestImpl.cpp.

900 {
901  return SqrtTestCommon<armnn::DataType::QSymmS16>(workloadFactory, memoryManager, 0.1f, 0);
902 }

◆ SqrtNNTest()

LayerTestResult<float, 5> SqrtNNTest ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager 
)

Definition at line 792 of file ActivationTestImpl.cpp.

References CopyDataFromITensorHandle(), CopyDataToITensorHandle(), IWorkloadFactory::CreateActivation(), IWorkloadFactory::CreateTensorHandle(), armnn::Float32, ActivationDescriptor::m_Function, QueueDescriptorWithParameters< LayerDescriptor >::m_Parameters, and armnn::Sqrt.

795 {
796  boost::ignore_unused(memoryManager);
797  const int inputDataSize = 120;
798  std::vector<float> inputData(inputDataSize);
799 
800  for (unsigned int i = 0u; i < inputDataSize; ++i)
801  {
802  inputData[i] = static_cast<float>(i) / 10;
803  }
804 
805  auto f = [](float value)
806  {
807  return std::sqrt(value);
808  };
809  std::vector<float> outputExpectedData(inputDataSize);
810  std::transform(inputData.begin(), inputData.end(), outputExpectedData.begin(), f);
811 
812  armnn::TensorInfo inputTensorInfo(
813  { 1u, 2u, 3u, 4u, 5u }, armnn::DataType::Float32);
814  armnn::TensorInfo outputTensorInfo(
815  { 1u, 2u, 3u, 4u, 5u }, armnn::DataType::Float32);
816 
817  LayerTestResult<float, 5> result(inputTensorInfo);
818 
819  auto input = MakeTensor<float, 5>(inputTensorInfo, inputData);
820 
821  std::unique_ptr<armnn::ITensorHandle> inputHandle = workloadFactory.CreateTensorHandle(inputTensorInfo);
822  std::unique_ptr<armnn::ITensorHandle> outputHandle = workloadFactory.CreateTensorHandle(outputTensorInfo);
823 
825  armnn::WorkloadInfo workloadInfo;
826  AddInputToWorkload(descriptor, workloadInfo, inputTensorInfo, inputHandle.get());
827  AddOutputToWorkload(descriptor, workloadInfo, outputTensorInfo, outputHandle.get());
828 
830 
831  std::unique_ptr<armnn::IWorkload> workload = workloadFactory.CreateActivation(descriptor, workloadInfo);
832 
833  inputHandle->Allocate();
834  outputHandle->Allocate();
835 
836  CopyDataToITensorHandle(inputHandle.get(), &input[0][0][0][0][0]);
837 
838  workload->Execute();
839 
840  CopyDataFromITensorHandle(&result.output[0][0][0][0][0], outputHandle.get());
841 
842  // Calculated manually.
843  result.outputExpected = MakeTensor<float, 5>(outputTensorInfo, outputExpectedData);
844 
845  return result;
846 };
void CopyDataToITensorHandle(armnn::ITensorHandle *tensorHandle, const void *memory)
virtual std::unique_ptr< ITensorHandle > CreateTensorHandle(const TensorInfo &tensorInfo, const bool IsMemoryManaged=true) const =0
void CopyDataFromITensorHandle(void *memory, const armnn::ITensorHandle *tensorHandle)
ActivationFunction m_Function
The activation function to use (Sigmoid, TanH, Linear, ReLu, BoundedReLu, SoftReLu, LeakyReLu, Abs, Sqrt, Square).
Definition: Descriptors.hpp:35
virtual std::unique_ptr< IWorkload > CreateActivation(const ActivationQueueDescriptor &descriptor, const WorkloadInfo &info) const

◆ SqrtTest()

LayerTestResult<float, 4> SqrtTest ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager 
)

Definition at line 883 of file ActivationTestImpl.cpp.

886 {
887  return SqrtTestCommon<armnn::DataType::Float32>(workloadFactory, memoryManager, 0.1f, 0);
888 }

◆ SqrtUint8Test()

LayerTestResult<uint8_t, 4> SqrtUint8Test ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager 
)

Definition at line 890 of file ActivationTestImpl.cpp.

893 {
894  return SqrtTestCommon<armnn::DataType::QAsymmU8>(workloadFactory, memoryManager, 0.0625f, 64);
895 }

◆ SquareInt16Test()

LayerTestResult<int16_t, 4> SquareInt16Test ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager 
)

Definition at line 953 of file ActivationTestImpl.cpp.

956 {
957  return SquareTestCommon<armnn::DataType::QSymmS16>(workloadFactory, memoryManager, 0.1f, 0);
958 }

◆ SquareTest()

LayerTestResult<float, 4> SquareTest ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager 
)

Definition at line 939 of file ActivationTestImpl.cpp.

942 {
943  return SquareTestCommon<armnn::DataType::Float32>(workloadFactory, memoryManager, 0.1f, 0);
944 }

◆ SquareUint8Test()

LayerTestResult<uint8_t, 4> SquareUint8Test ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager 
)

Definition at line 946 of file ActivationTestImpl.cpp.

949 {
950  return SquareTestCommon<armnn::DataType::QAsymmU8>(workloadFactory, memoryManager, 0.0625f, 64);
951 }

◆ TanhInt16Test()

LayerTestResult<int16_t, 4> TanhInt16Test ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager 
)

Definition at line 1011 of file ActivationTestImpl.cpp.

1014 {
1015  return TanhTestCommon<armnn::DataType::QSymmS16>(workloadFactory, memoryManager, 0.1f, 0);
1016 }

◆ TanhTest()

LayerTestResult<float, 4> TanhTest ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager 
)

Definition at line 997 of file ActivationTestImpl.cpp.

1000 {
1001  return TanhTestCommon<armnn::DataType::Float32>(workloadFactory, memoryManager, 0.1f, 0);
1002 }

◆ TanhUint8Test()

LayerTestResult<uint8_t, 4> TanhUint8Test ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager 
)

Definition at line 1004 of file ActivationTestImpl.cpp.

1007 {
1008  return TanhTestCommon<armnn::DataType::QAsymmU8>(workloadFactory, memoryManager, 0.1f, 64);
1009 }