ArmNN
 20.11
RsqrtTestImpl.hpp File Reference

Go to the source code of this file.

Functions

template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
LayerTestResult< T, 2 > Rsqrt2dTest (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory)
 
template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
LayerTestResult< T, 3 > Rsqrt3dTest (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory)
 
template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
LayerTestResult< T, 2 > RsqrtZeroTest (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory)
 
template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
LayerTestResult< T, 2 > RsqrtNegativeTest (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory)
 

Function Documentation

◆ Rsqrt2dTest()

LayerTestResult<T, 2> Rsqrt2dTest ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager,
const armnn::ITensorHandleFactory tensorHandleFactory 
)

Definition at line 11 of file RsqrtTestImpl.cpp.

References armnn::Rsqrt.

15 {
16  const unsigned int inputShape[] = { 2, 2 };
17 
18  std::vector<float> inputValues
19  {
20  1.f, 4.f,
21  16.f, 25.f
22  };
23 
24  std::vector<float> expectedOutputValues
25  {
26  1.f, 0.5f,
27  0.25f, 0.2f
28  };
29 
30  return ElementwiseUnaryTestHelper<2, ArmnnType>(
31  workloadFactory,
32  memoryManager,
34  inputShape,
35  inputValues,
36  inputShape,
37  expectedOutputValues,
38  tensorHandleFactory);
39 }

◆ Rsqrt3dTest()

LayerTestResult<T, 3> Rsqrt3dTest ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager,
const armnn::ITensorHandleFactory tensorHandleFactory 
)

Definition at line 42 of file RsqrtTestImpl.cpp.

References armnn::Rsqrt.

46 {
47  const unsigned int inputShape[] = { 3, 1, 2 };
48 
49  std::vector<float> inputValues
50  {
51  1.f, 4.f, 16.f,
52  25.f, 64.f, 100.f
53  };
54 
55  std::vector<float> expectedOutputValues
56  {
57  1.f, 0.5f, 0.25f,
58  0.2f, 0.125f, 0.1f
59  };
60 
61  return ElementwiseUnaryTestHelper<3, ArmnnType>(
62  workloadFactory,
63  memoryManager,
65  inputShape,
66  inputValues,
67  inputShape,
68  expectedOutputValues,
69  tensorHandleFactory);
70 }

◆ RsqrtNegativeTest()

LayerTestResult<T, 2> RsqrtNegativeTest ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager,
const armnn::ITensorHandleFactory tensorHandleFactory 
)

Definition at line 102 of file RsqrtTestImpl.cpp.

References armnn::Rsqrt.

106 {
107  const unsigned int inputShape[] = { 1, 2 };
108 
109  std::vector<float> inputValues
110  {
111  -25.f, -16.f
112  };
113 
114  std::vector<float> expectedOutputValues
115  {
116  -NAN, -NAN
117  };
118 
119  return ElementwiseUnaryTestHelper<2, ArmnnType>(
120  workloadFactory,
121  memoryManager,
123  inputShape,
124  inputValues,
125  inputShape,
126  expectedOutputValues,
127  tensorHandleFactory);
128 }

◆ RsqrtZeroTest()

LayerTestResult<T, 2> RsqrtZeroTest ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager,
const armnn::ITensorHandleFactory tensorHandleFactory 
)

Definition at line 73 of file RsqrtTestImpl.cpp.

References armnn::Rsqrt.

77 {
78  const unsigned int inputShape[] = { 1, 2 };
79 
80  std::vector<float> inputValues
81  {
82  0.f, -0.f
83  };
84 
85  std::vector<float> expectedOutputValues
86  {
87  INFINITY, -INFINITY
88  };
89 
90  return ElementwiseUnaryTestHelper<2, ArmnnType>(
91  workloadFactory,
92  memoryManager,
94  inputShape,
95  inputValues,
96  inputShape,
97  expectedOutputValues,
98  tensorHandleFactory);
99 }