ArmNN
 21.11
LogSoftmaxTestImpl.hpp File Reference

Go to the source code of this file.

Functions

template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
LayerTestResult< T, 4 > LogSoftmaxTest1 (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory)
 
template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
LayerTestResult< T, 4 > LogSoftmaxTest2 (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory)
 
template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
LayerTestResult< T, 4 > LogSoftmaxTest3 (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory)
 
template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
LayerTestResult< T, 4 > LogSoftmaxTest4 (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory)
 

Function Documentation

◆ LogSoftmaxTest1()

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

Definition at line 76 of file LogSoftmaxTestImpl.cpp.

References SoftmaxDescriptor::m_Axis, SoftmaxDescriptor::m_Beta, and QueueDescriptorWithParameters< LayerDescriptor >::m_Parameters.

80 {
81  const armnn::TensorShape inputOutputShape{1, 1, 2, 4};
82 
83  armnn::TensorInfo inputTensorInfo(inputOutputShape, ArmnnType);
84  armnn::TensorInfo outputTensorInfo(inputOutputShape, ArmnnType);
85 
86  std::vector<float> inputValues
87  {
88  0.f, -6.f, 2.f, 4.f,
89  3.f, -2.f, 10.f, 1.f
90  };
91 
92  std::vector<float> expectedOutputValues
93  {
94  -4.14297f, -10.14297f, -2.14297f, -0.14297f,
95  -7.00104f, -12.00104f, -0.00105f, -9.00104f
96  };
97 
99  descriptor.m_Parameters.m_Beta = 1.0f; // default beta
100  descriptor.m_Parameters.m_Axis = -1; // default axis
101 
102  return LogSoftmaxTestImpl<ArmnnType, 4>(
103  workloadFactory,
104  memoryManager,
105  tensorHandleFactory,
106  inputTensorInfo,
107  outputTensorInfo,
108  inputValues,
109  expectedOutputValues,
110  descriptor);
111 }
int m_Axis
Scalar, defaulted to the last index (-1), specifying the dimension the activation will be performed o...
float m_Beta
Exponentiation value.

◆ LogSoftmaxTest2()

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

Definition at line 114 of file LogSoftmaxTestImpl.cpp.

References SoftmaxDescriptor::m_Axis, SoftmaxDescriptor::m_Beta, and QueueDescriptorWithParameters< LayerDescriptor >::m_Parameters.

118 {
119  const armnn::TensorShape inputOutputShape{1, 1, 2, 4};
120 
121  armnn::TensorInfo inputTensorInfo(inputOutputShape, ArmnnType);
122  armnn::TensorInfo outputTensorInfo(inputOutputShape, ArmnnType);
123 
124  std::vector<float> inputValues
125  {
126  0.f, -6.f, 2.f, 4.f,
127  3.f, -2.f, 10.f, 1.f
128  };
129 
130  std::vector<float> expectedOutputValues
131  {
132  -4.14297f, -10.14297f, -2.14297f, -0.14297f,
133  -7.00104f, -12.00104f, -0.00105f, -9.00104f
134  };
135 
137  descriptor.m_Parameters.m_Beta = 1.0f; // default beta
138  descriptor.m_Parameters.m_Axis = 3; // positive axis
139 
140  return LogSoftmaxTestImpl<ArmnnType, 4>(
141  workloadFactory,
142  memoryManager,
143  tensorHandleFactory,
144  inputTensorInfo,
145  outputTensorInfo,
146  inputValues,
147  expectedOutputValues,
148  descriptor);
149 }
int m_Axis
Scalar, defaulted to the last index (-1), specifying the dimension the activation will be performed o...
float m_Beta
Exponentiation value.

◆ LogSoftmaxTest3()

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

Definition at line 152 of file LogSoftmaxTestImpl.cpp.

References SoftmaxDescriptor::m_Axis, SoftmaxDescriptor::m_Beta, and QueueDescriptorWithParameters< LayerDescriptor >::m_Parameters.

156 {
157  const armnn::TensorShape inputOutputShape{1, 1, 2, 4};
158 
159  armnn::TensorInfo inputTensorInfo(inputOutputShape, ArmnnType);
160  armnn::TensorInfo outputTensorInfo(inputOutputShape, ArmnnType);
161 
162  std::vector<float> inputValues
163  {
164  0.0f, -0.6f, 0.2f, 0.4f,
165  0.3f, -0.2f, 1.0f, 0.1f
166  };
167 
168  std::vector<float> expectedOutputValues
169  {
170  -4.14297f, -10.14297f, -2.14297f, -0.14297f,
171  -7.00104f, -12.00104f, -0.00105f, -9.00104f
172  };
173 
175  descriptor.m_Parameters.m_Beta = 10.0f; // non-default beta
176  descriptor.m_Parameters.m_Axis = 3; // positive axis
177 
178  return LogSoftmaxTestImpl<ArmnnType, 4>(
179  workloadFactory,
180  memoryManager,
181  tensorHandleFactory,
182  inputTensorInfo,
183  outputTensorInfo,
184  inputValues,
185  expectedOutputValues,
186  descriptor);
187 }
int m_Axis
Scalar, defaulted to the last index (-1), specifying the dimension the activation will be performed o...
float m_Beta
Exponentiation value.

◆ LogSoftmaxTest4()

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

Definition at line 190 of file LogSoftmaxTestImpl.cpp.

References SoftmaxDescriptor::m_Axis, SoftmaxDescriptor::m_Beta, and QueueDescriptorWithParameters< LayerDescriptor >::m_Parameters.

194 {
195  const armnn::TensorShape inputOutputShape{1, 1, 2, 4};
196 
197  armnn::TensorInfo inputTensorInfo(inputOutputShape, ArmnnType);
198  armnn::TensorInfo outputTensorInfo(inputOutputShape, ArmnnType);
199 
200  std::vector<float> inputValues
201  {
202  0.f, -6.f, 2.f, 4.f,
203  3.f, -2.f, 10.f, 1.f
204  };
205 
206  std::vector<float> expectedOutputValues
207  {
208  -3.048587f, -4.018149f, -8.000336f, -0.048587f,
209  -0.048587f, -0.018149f, -0.000335f, -3.048587f
210  };
211 
213  descriptor.m_Parameters.m_Beta = 1.0f; // default beta
214  descriptor.m_Parameters.m_Axis = -2; // negative axis
215 
216  return LogSoftmaxTestImpl<ArmnnType, 4>(
217  workloadFactory,
218  memoryManager,
219  tensorHandleFactory,
220  inputTensorInfo,
221  outputTensorInfo,
222  inputValues,
223  expectedOutputValues,
224  descriptor);
225 }
int m_Axis
Scalar, defaulted to the last index (-1), specifying the dimension the activation will be performed o...
float m_Beta
Exponentiation value.