ArmNN
 24.02
ArmComputeUtils.hpp
Go to the documentation of this file.
1 //
2 // Copyright © 2017-2023 Arm Ltd. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 #pragma once
6 
7 #include <armnn/Descriptors.hpp>
8 #include <armnn/Tensor.hpp>
13 
14 #include <arm_compute/runtime/FunctionDescriptors.h>
15 #include <arm_compute/function_info/FullyConnectedLayerInfo.h>
16 
17 #if defined(ARMCOMPUTENEON_ENABLED)
19 #endif
20 
21 #if defined(ARMCOMPUTECL_ENABLED)
23 #endif
24 
25 namespace armnn
26 {
27 
28 inline arm_compute::NormalizationLayerInfo
30  armnn::DataLayout dataLayout)
31 {
32  unsigned int depthDimension = dataLayout == armnn::DataLayout::NCHW ? 1 : 3;
33  const unsigned int depth = tensorInfo.GetShape()[depthDimension];
34 
35  // At the time of writing, {CL|Neon}L2Normalization performs the reduction only along dimension 0. This version of
36  // L2 Normalization always performs the reduction along the depth axis, though. Thus, we repurpose
37  // {CL|Neon}NormalizationLayers to act as depthwise L2 normalizations by carefully chosing the normalization
38  // parameters.
39  //
40  // Please refer to both the reference implementation of the normalization layer and the implementation of
41  // {CL|Neon}NormalizationLayer when checking the derivations for the parameter values below.
42 
43  // Make sure normalization covers the entire depth range. ACL requires the normalization size to be odd.
44  // CL: This does not result in extra kernel threads not doing any work: See usage of the RADIUS parameter in
45  // ACL's normalization_layer_cross_map() CL function.
46  const uint32_t normSize = depth * 2u + 1u;
47 
48  // See ACL's NormalizationLayerInfo::scale_coeff() definition.
49  // For the reference implementation, to make alpha_ become 1, we'd have to use alpha = normSize instead.
50  const float alpha = 1.0f;
51 
52  // Don't offset the reduction.
53  const float kappa = 0.0f;
54 
55  // pow(reduction, -0.5) = 1 / sqrt(reduction)
56  const float beta = 0.5f;
57 
58  return arm_compute::NormalizationLayerInfo(arm_compute::NormType::CROSS_MAP, normSize, alpha, beta, kappa, false);
59 }
60 
63 {
64  using AclActivationFunction = arm_compute::ActivationLayerInfo::ActivationFunction;
65 
66  switch (armnnFunction)
67  {
68  case ActivationFunction::Linear: return AclActivationFunction::LINEAR;
69  // Arm compute's 'logistic' function is non-parameterized, so it is exactly a sigmoid function.
70  case ActivationFunction::Sigmoid: return AclActivationFunction::LOGISTIC;
71  case ActivationFunction::ReLu: return AclActivationFunction::RELU;
72  case ActivationFunction::BoundedReLu: return AclActivationFunction::LU_BOUNDED_RELU;
73  case ActivationFunction::SoftReLu: return AclActivationFunction::SOFT_RELU;
74  case ActivationFunction::LeakyReLu: return AclActivationFunction::LEAKY_RELU;
75  case ActivationFunction::Abs: return AclActivationFunction::ABS;
76  case ActivationFunction::Sqrt: return AclActivationFunction::SQRT;
77  case ActivationFunction::Square: return AclActivationFunction::SQUARE;
78  case ActivationFunction::TanH: return AclActivationFunction::TANH;
79  case ActivationFunction::Elu: return AclActivationFunction::ELU;
80  case ActivationFunction::HardSwish: return AclActivationFunction::HARD_SWISH;
81  case ActivationFunction::Gelu: return AclActivationFunction::GELU;
82  default: throw InvalidArgumentException("Unsupported activation function");
83  }
84 }
85 
86 inline arm_compute::ActivationLayerInfo
88 {
89  return arm_compute::ActivationLayerInfo(ConvertActivationFunctionToAclActivationFunction(actDesc.m_Function),
90  actDesc.m_A, actDesc.m_B);
91 }
92 
93 inline arm_compute::ActivationLayerInfo
95 {
96  if (activationDescPtr != nullptr)
97  {
99  *activationDescPtr));
100  }
101  return arm_compute::ActivationLayerInfo();
102 }
103 
104 inline arm_compute::ActivationLayerInfo
106 {
107  const ActivationDescriptor* activationDescPtr = queueDescriptor.GetAdditionalInformation<ActivationDescriptor>();
108 
109  if (activationDescPtr != nullptr)
110  {
112  *activationDescPtr));
113  }
114  return arm_compute::ActivationLayerInfo();
115 }
116 
117 inline arm_compute::ActivationLayerInfo
118 ConvertLstmActivationFuncToAclLayerInfo(uint32_t activationFunction)
119 {
120  // For preparing the object for the class ActivationLayerInfo, we need to consider 5 situations.
121  switch (activationFunction)
122  {
123  case 0:
124  return arm_compute::ActivationLayerInfo(); // no activation, do nothing
125  case 1:
126  return arm_compute::ActivationLayerInfo(arm_compute::ActivationLayerInfo::ActivationFunction::RELU);
127  case 3:
128  return arm_compute::ActivationLayerInfo(
129  arm_compute::ActivationLayerInfo::ActivationFunction::BOUNDED_RELU, 6.0);
130  case 4:
131  return arm_compute::ActivationLayerInfo(
132  arm_compute::ActivationLayerInfo::ActivationFunction::TANH, 1.0, 1.0);
133  case 6:
134  return arm_compute::ActivationLayerInfo(
135  arm_compute::ActivationLayerInfo::ActivationFunction::LOGISTIC);
136  default:
137  throw armnn::Exception("Wrong Type of Activation Function!");
138  }
139 }
140 
142 {
143  switch (descriptor.m_Operation)
144  {
145  case ComparisonOperation::Greater: return arm_compute::ComparisonOperation::Greater;
146  case ComparisonOperation::GreaterOrEqual: return arm_compute::ComparisonOperation::GreaterEqual;
147  case ComparisonOperation::Less: return arm_compute::ComparisonOperation::Less;
148  case ComparisonOperation::LessOrEqual: return arm_compute::ComparisonOperation::LessEqual;
149  case ComparisonOperation::Equal: return arm_compute::ComparisonOperation::Equal;
150  case ComparisonOperation::NotEqual: return arm_compute::ComparisonOperation::NotEqual;
151  default: throw InvalidArgumentException("Unsupported comparison function");
152  }
153 }
154 
155 inline arm_compute::PoolingType ConvertPoolingAlgorithmToAclPoolingType(PoolingAlgorithm poolingAlgorithm)
156 {
157  using arm_compute::PoolingType;
158 
159  switch (poolingAlgorithm)
160  {
161  case PoolingAlgorithm::Max: return PoolingType::MAX;
162  case PoolingAlgorithm::Average: return PoolingType::AVG;
163  case PoolingAlgorithm::L2: return PoolingType::L2;
164  default: throw InvalidArgumentException("Unsupported pooling algorithm");
165  }
166 }
167 
169  rounding)
170 {
171  using arm_compute::DimensionRoundingType;
172 
173  switch (rounding)
174  {
175  case OutputShapeRounding::Ceiling: return DimensionRoundingType::CEIL;
176  case OutputShapeRounding::Floor: return DimensionRoundingType::FLOOR;
177  default: throw InvalidArgumentException("Unsupported Output Shape Rounding type");
178  }
179 }
180 
181 inline arm_compute::NormType
183 {
184  using arm_compute::NormType;
185  switch (channelType)
186  {
187  case NormalizationAlgorithmChannel::Across: return NormType::CROSS_MAP;
188  case NormalizationAlgorithmChannel::Within: return NormType::IN_MAP_2D;
189  default: throw InvalidArgumentException("Unsupported normalization algorithm channel type");
190  }
191 }
192 
193 inline arm_compute::FullyConnectedLayerInfo
195  const ActivationDescriptor* activationDesc)
196 {
197  arm_compute::FullyConnectedLayerInfo fc_info;
198  fc_info.transpose_weights = fullyConnectedDesc.m_TransposeWeightMatrix;
199  fc_info.activation_info = ConvertActivationDescriptorToAclActivationLayerInfo(activationDesc);
200  return fc_info;
201 }
202 
203 inline arm_compute::FullyConnectedLayerInfo
205  arm_compute::ActivationLayerInfo activationLayerInfo)
206 {
207  arm_compute::FullyConnectedLayerInfo fc_info;
208  fc_info.transpose_weights = fullyConnectedDesc.m_TransposeWeightMatrix;
209  fc_info.activation_info = activationLayerInfo;
210  return fc_info;
211 }
212 
213 inline arm_compute::InterpolationPolicy ConvertResizeMethodToAclInterpolationPolicy(ResizeMethod resizeMethod)
214 {
215  switch (resizeMethod)
216  {
218  return arm_compute::InterpolationPolicy::BILINEAR;
220  return arm_compute::InterpolationPolicy::NEAREST_NEIGHBOR;
221  default:
222  throw InvalidArgumentException("Unsupported resize method");
223  }
224 }
225 
226 template<typename T>
227 inline T ComputeSoftmaxAclAxis(const SoftmaxDescriptor& softmaxDesc, const armnn::TensorInfo& tensor)
228 {
229  // Detect the Android default value of -1 and return the ACL default value of 0.
230  if (softmaxDesc.m_Axis == -1)
231  {
232  return 0;
233  }
234 
235  unsigned int dim = tensor.GetNumDimensions();
236 
237  ARMNN_ASSERT(dim != 0);
238 
239  // Currently ArmNN support axis 1.
240  auto aclAxis = (static_cast<T>(dim) - 1);
241  aclAxis = aclAxis > 0 ? aclAxis -1 : aclAxis;
242 
243  return aclAxis;
244 }
245 
246 inline std::set<unsigned int> ComputeSplitAxis(const armnn::SplitterDescriptor& desc, const TensorShape& input)
247 {
248  unsigned int numSplit = desc.GetNumViews();
249  unsigned int numDimensions = desc.GetNumDimensions();
250  std::set<unsigned int> splitAxis;
251 
252  if (desc.HasAxis())
253  {
254  splitAxis.insert(armnnUtils::GetUnsignedAxis(desc.GetNumDimensions(), desc.GetAxis()));
255  }
256  else
257  {
258  for (unsigned int i = 0; i < numSplit; ++i)
259  {
260  for (unsigned int dimIdx = 0; dimIdx < numDimensions; ++dimIdx)
261  {
262  if (desc.GetViewSizes(i)[dimIdx] != input[dimIdx])
263  {
264  splitAxis.insert(dimIdx);
265  }
266  }
267  }
268  }
269  return splitAxis;
270 }
271 
272 /// Function to convert ArmNN axis (left to right) to ACL axis (right to left) ranging from [-rank, rank)
273 inline int ComputeAclAxis(const int& armnnAxis, const armnn::TensorInfo& tensor)
274 {
275  int rank = static_cast<int>(tensor.GetNumDimensions());
276 
277  ARMNN_ASSERT(rank != 0);
278  ARMNN_ASSERT((-1 * rank) <= armnnAxis);
279  ARMNN_ASSERT(armnnAxis < rank);
280 
281  int sign = (armnnAxis < 0) ? -1 : 1;
282  int aclAxis = sign * rank - 1 - armnnAxis;
283 
284  return aclAxis;
285 }
286 
287 /// Utility function used to setup an arm_compute::Conv3dInfo object from convolution3d descriptor.
288 inline arm_compute::Conv3dInfo ComputeConv3DInfo(const armnn::Convolution3dDescriptor descriptor,
289  bool isFastMathEnabled,
290  const ActivationDescriptor* activationDescriptor)
291 {
292  const arm_compute::Size3D stride{descriptor.m_StrideX, descriptor.m_StrideY, descriptor.m_StrideZ};
293  const arm_compute::Padding3D padding{descriptor.m_PadLeft, descriptor.m_PadRight,
294  descriptor.m_PadTop, descriptor.m_PadBottom,
295  descriptor.m_PadFront, descriptor.m_PadBack};
296  const arm_compute::Size3D dilation{descriptor.m_DilationX, descriptor.m_DilationY, descriptor.m_DilationZ};
297 
298  const arm_compute::ActivationLayerInfo activationInfo =
300  const auto roundType = arm_compute::DimensionRoundingType::FLOOR;
301 
302  return arm_compute::Conv3dInfo{stride, padding, activationInfo, dilation, roundType, isFastMathEnabled};
303 }
304 
305 inline arm_compute::Conv3dInfo ComputeConv3DInfo(const armnn::Convolution3dQueueDescriptor queueDescriptor,
306  bool isFastMathEnabled)
307 {
308  auto descriptor = queueDescriptor.m_Parameters;
309  const arm_compute::Size3D stride{descriptor.m_StrideX, descriptor.m_StrideY, descriptor.m_StrideZ};
310  const arm_compute::Padding3D padding{descriptor.m_PadLeft, descriptor.m_PadRight,
311  descriptor.m_PadTop, descriptor.m_PadBottom,
312  descriptor.m_PadFront, descriptor.m_PadBack};
313  const arm_compute::Size3D dilation{descriptor.m_DilationX, descriptor.m_DilationY, descriptor.m_DilationZ};
314 
315  const arm_compute::ActivationLayerInfo activationInfo =
317  const auto roundType = arm_compute::DimensionRoundingType::FLOOR;
318 
319  return arm_compute::Conv3dInfo{stride, padding, activationInfo, dilation, roundType, isFastMathEnabled};
320 }
321 
323 {
324  switch (paddingMode)
325  {
326  case PaddingMode::Constant: return arm_compute::PaddingMode::CONSTANT;
327  case PaddingMode::Reflect: return arm_compute::PaddingMode::REFLECT;
328  case PaddingMode::Symmetric: return arm_compute::PaddingMode::SYMMETRIC;
329  default: throw InvalidArgumentException("Unsupported Padding Mode");
330  }
331 }
332 
333 inline arm_compute::ReductionOperation ConvertReductionOperationToAcl(const ReduceDescriptor& descriptor)
334 {
335  switch (descriptor.m_ReduceOperation)
336  {
337  case ReduceOperation::Sum: return arm_compute::ReductionOperation::SUM;
338  case ReduceOperation::Mean: return arm_compute::ReductionOperation::MEAN_SUM;
339  case ReduceOperation::Max: return arm_compute::ReductionOperation::MAX;
340  case ReduceOperation::Min: return arm_compute::ReductionOperation::MIN;
341  case ReduceOperation::Prod: return arm_compute::ReductionOperation::PROD;
342  default: throw InvalidArgumentException("Unsupported Reduction operation");
343  }
344 }
345 
346 /// Function to compute the output tensor shape based on the axes and if keepDims is set.
348  const std::vector<uint32_t>& vAxis,
349  const bool keepDims)
350 {
351  auto reducedTensorInfo = input;
352  unsigned int rank = reducedTensorInfo.GetNumDimensions();
353  unsigned int outputRank = 0;
354  // Calculate output dimension
355  if (keepDims)
356  {
357  outputRank = rank;
358  }
359  else if (vAxis.empty())
360  {
361  outputRank = 1;
362  }
363  else if (vAxis.size() > reducedTensorInfo.GetNumDimensions())
364  {
365  throw LayerValidationException("ReduceLayer: Dimensions to reduce can not be bigger than input dimensions");
366  }
367  else
368  {
369  outputRank = reducedTensorInfo.GetNumDimensions() - armnn::numeric_cast<unsigned int>(vAxis.size());
370  if (outputRank == 0)
371  {
372  outputRank = 1;
373  }
374  }
375  std::vector<unsigned int> dimSizes(outputRank, 1);
376  if (!vAxis.empty())
377  {
378  // Skip the dimension that has been reduced unless keepDims is true.
379  unsigned int outputIndex = 0;
380  for (unsigned int i = 0; i < reducedTensorInfo.GetNumDimensions(); ++i)
381  {
382  if (std::find(vAxis.begin(), vAxis.end(), i) == vAxis.end())
383  {
384  dimSizes[outputIndex] = armnn::numeric_cast<unsigned int>(reducedTensorInfo.GetShape()[i]);
385  ++outputIndex;
386  }
387  else if (keepDims)
388  {
389  dimSizes[outputIndex] = 1;
390  ++outputIndex;
391  }
392  }
393  }
394  const TensorShape inferredShape = TensorShape(outputRank, dimSizes.data());
395  reducedTensorInfo.SetShape(inferredShape);
396  return reducedTensorInfo;
397 }
398 
399 /// Macro function check if layer with multiple axes is supported on each backend
400 #define IS_MULTI_AXES_REDUCE_SUPPORTED(func, input, desc, status) \
401  armnn::TensorInfo inputTensorInfo = input; \
402  unsigned int recalulatedAxis = 0; \
403  std::vector<uint32_t> axes; \
404  \
405  for (unsigned int i = 0; i != desc.m_vAxis.size(); ++i) \
406  { \
407  axes.emplace_back(desc.m_vAxis[i]); \
408  \
409  const armnn::TensorInfo& reducedTensorInfo = \
410  ComputeReductionTensorShape(input, axes, desc.m_KeepDims); \
411  \
412  std::vector<uint32_t> singleAxis(1, desc.m_vAxis[i] - recalulatedAxis); \
413  \
414  armnn::ReduceDescriptor newReduceDescriptor = desc; \
415  newReduceDescriptor.m_vAxis.assign(singleAxis.begin(), singleAxis.end()); \
416  \
417  status = func(inputTensorInfo, reducedTensorInfo, newReduceDescriptor); \
418  if (!status) \
419  { \
420  break; \
421  } \
422  \
423  if (!desc.m_KeepDims) \
424  { \
425  recalulatedAxis++; \
426  } \
427  \
428  inputTensorInfo = reducedTensorInfo; \
429  }
430 
431 } // namespace armnn
ARMNN_ASSERT
#define ARMNN_ASSERT(COND)
Definition: Assert.hpp:14
armnn::PaddingMode::Symmetric
@ Symmetric
armnn::ViewsDescriptor
A ViewsDescriptor for the SplitterLayer.
Definition: Descriptors.hpp:244
armnn::ActivationDescriptor
An ActivationDescriptor for the ActivationLayer.
Definition: Descriptors.hpp:36
armnn::NormalizationAlgorithmChannel::Within
@ Within
armnn::FullyConnectedDescriptor
A FullyConnectedDescriptor for the FullyConnectedLayer.
Definition: Descriptors.hpp:507
armnn::ComparisonOperation::LessOrEqual
@ LessOrEqual
armnn::ActivationFunction::LeakyReLu
@ LeakyReLu
armnn::ResizeMethod
ResizeMethod
Definition: Types.hpp:166
armnn::DataLayout
DataLayout
Definition: Types.hpp:62
Descriptors.hpp
WorkloadData.hpp
armnn::FullyConnectedDescriptor::m_TransposeWeightMatrix
bool m_TransposeWeightMatrix
Enable/disable transpose weight matrix.
Definition: Descriptors.hpp:528
armnn::ConvertOutputShapeRoundingToAclDimensionRoundingType
arm_compute::DimensionRoundingType ConvertOutputShapeRoundingToAclDimensionRoundingType(OutputShapeRounding rounding)
Definition: ArmComputeUtils.hpp:168
armnn::QueueDescriptor::GetAdditionalInformation
const T * GetAdditionalInformation() const
Definition: WorkloadData.hpp:47
armnn::ActivationFunction::SoftReLu
@ SoftReLu
armnn::ConvertResizeMethodToAclInterpolationPolicy
arm_compute::InterpolationPolicy ConvertResizeMethodToAclInterpolationPolicy(ResizeMethod resizeMethod)
Definition: ArmComputeUtils.hpp:213
armnn::Convolution3dDescriptor::m_PadFront
uint32_t m_PadFront
Padding front value in the depth dimension.
Definition: Descriptors.hpp:637
armnn::ActivationDescriptor::m_A
float m_A
Alpha upper bound value used by the activation functions. (BoundedReLu, Linear, TanH,...
Definition: Descriptors.hpp:61
armnnUtils::GetUnsignedAxis
unsigned int GetUnsignedAxis(const unsigned int inputDimension, const int axis)
Definition: TensorUtils.cpp:236
armnn::ViewsDescriptor::HasAxis
bool HasAxis() const
Returns true if an axis has been set.
Definition: Descriptors.cpp:387
armnn::ConvertAdditionalInfoToAclActivationLayerInfo
arm_compute::ActivationLayerInfo ConvertAdditionalInfoToAclActivationLayerInfo(const QueueDescriptor &queueDescriptor)
Definition: ArmComputeUtils.hpp:105
armnn::ActivationFunction::Sqrt
@ Sqrt
armnn::TensorInfo
Definition: Tensor.hpp:152
armnn::OutputShapeRounding
OutputShapeRounding
Definition: Types.hpp:221
armnn::OutputShapeRounding::Floor
@ Floor
armnn::TensorInfo::GetNumDimensions
unsigned int GetNumDimensions() const
Definition: Tensor.hpp:197
armnn::ActivationFunction::TanH
@ TanH
ClReduceWorkload.hpp
armnn::Convolution3dDescriptor::m_PadTop
uint32_t m_PadTop
Padding top value in the height dimension.
Definition: Descriptors.hpp:633
armnn::PoolingAlgorithm::L2
@ L2
armnn::Convolution3dDescriptor::m_DilationX
uint32_t m_DilationX
Dilation along x axis.
Definition: Descriptors.hpp:647
armnn::PaddingMode
PaddingMode
The padding mode controls whether the padding should be filled with constant values (Constant),...
Definition: Types.hpp:200
armnn::Convolution3dDescriptor::m_PadBottom
uint32_t m_PadBottom
Padding bottom value in the height dimension.
Definition: Descriptors.hpp:635
armnn::ActivationFunction::BoundedReLu
@ BoundedReLu
min(a, max(b, input)) ReLu1 & ReLu6.
armnn::ComputeConv3DInfo
arm_compute::Conv3dInfo ComputeConv3DInfo(const armnn::Convolution3dDescriptor descriptor, bool isFastMathEnabled, const ActivationDescriptor *activationDescriptor)
Utility function used to setup an arm_compute::Conv3dInfo object from convolution3d descriptor.
Definition: ArmComputeUtils.hpp:288
armnn::ComputeSplitAxis
std::set< unsigned int > ComputeSplitAxis(const armnn::SplitterDescriptor &desc, const TensorShape &input)
Definition: ArmComputeUtils.hpp:246
armnn::ReduceOperation::Mean
@ Mean
armnn::ActivationFunction::HardSwish
@ HardSwish
armnn::ActivationFunction::Gelu
@ Gelu
NumericCast.hpp
armnn::NormalizationAlgorithmChannel::Across
@ Across
armnn::ReduceDescriptor::m_ReduceOperation
ReduceOperation m_ReduceOperation
Specifies the reduction operation to execute.
Definition: Descriptors.hpp:1558
armnn::Convolution3dQueueDescriptor
Definition: WorkloadData.hpp:216
TensorUtils.hpp
armnn::ComparisonOperation::NotEqual
@ NotEqual
armnn::ComparisonOperation::GreaterOrEqual
@ GreaterOrEqual
armnn::ViewsDescriptor::GetViewSizes
const uint32_t * GetViewSizes(uint32_t idx) const
Get the view sizes at the int value idx.
Definition: Descriptors.cpp:346
Assert.hpp
armnn::TensorShape
Definition: Tensor.hpp:20
armnn::Convolution3dDescriptor::m_PadRight
uint32_t m_PadRight
Padding right value in the width dimension.
Definition: Descriptors.hpp:631
armnn::ConvertReductionOperationToAcl
arm_compute::ReductionOperation ConvertReductionOperationToAcl(const ReduceDescriptor &descriptor)
Definition: ArmComputeUtils.hpp:333
armnn::QueueDescriptorWithParameters::m_Parameters
LayerDescriptor m_Parameters
Definition: WorkloadData.hpp:66
armnn::ComparisonOperation::Less
@ Less
armnn::ViewsDescriptor::GetAxis
int32_t GetAxis() const
Get the axis value.
Definition: Descriptors.cpp:381
NeonReduceWorkload.hpp
armnn::Convolution3dDescriptor::m_DilationZ
uint32_t m_DilationZ
Dilation along z axis.
Definition: Descriptors.hpp:651
armnn::ActivationFunction::Elu
@ Elu
armnn::LayerValidationException
Definition: Exceptions.hpp:105
armnn::CreateAclNormalizationLayerInfoForL2Normalization
arm_compute::NormalizationLayerInfo CreateAclNormalizationLayerInfoForL2Normalization(const armnn::TensorInfo &tensorInfo, armnn::DataLayout dataLayout)
Definition: ArmComputeUtils.hpp:29
armnn::InvalidArgumentException
Definition: Exceptions.hpp:80
armnn::ConvertLstmActivationFuncToAclLayerInfo
arm_compute::ActivationLayerInfo ConvertLstmActivationFuncToAclLayerInfo(uint32_t activationFunction)
Definition: ArmComputeUtils.hpp:118
armnn::ActivationFunction::Linear
@ Linear
armnn::QueueDescriptor
Definition: WorkloadData.hpp:24
armnn::Convolution3dDescriptor::m_PadLeft
uint32_t m_PadLeft
Padding left value in the width dimension.
Definition: Descriptors.hpp:629
armnn::ActivationDescriptor::m_Function
ActivationFunction m_Function
The activation function to use (Sigmoid, TanH, Linear, ReLu, BoundedReLu, SoftReLu,...
Definition: Descriptors.hpp:59
armnn::Convolution3dDescriptor::m_StrideY
uint32_t m_StrideY
Stride value when proceeding through input for the height dimension.
Definition: Descriptors.hpp:643
armnn::ReduceOperation::Sum
@ Sum
armnn::Convolution3dDescriptor::m_StrideX
uint32_t m_StrideX
Stride value when proceeding through input for the width dimension.
Definition: Descriptors.hpp:641
armnn::Convolution3dDescriptor
A Convolution3dDescriptor for the Convolution3dLayer.
Definition: Descriptors.hpp:588
armnn::Exception
Base class for all ArmNN exceptions so that users can filter to just those.
Definition: Exceptions.hpp:46
armnn::ConvertActivationDescriptorToAclActivationLayerInfo
arm_compute::ActivationLayerInfo ConvertActivationDescriptorToAclActivationLayerInfo(const ActivationDescriptor &actDesc)
Definition: ArmComputeUtils.hpp:87
armnn::ResizeMethod::NearestNeighbor
@ NearestNeighbor
armnn::ActivationFunction
ActivationFunction
Definition: Types.hpp:86
armnn::ConvertComparisonOperationToAcl
arm_compute::ComparisonOperation ConvertComparisonOperationToAcl(const ComparisonDescriptor &descriptor)
Definition: ArmComputeUtils.hpp:141
armnn::PoolingAlgorithm::Average
@ Average
armnn::ReduceOperation::Prod
@ Prod
armnn::ActivationFunction::Abs
@ Abs
armnn::ComparisonDescriptor
A ComparisonDescriptor for the ComparisonLayer.
Definition: Descriptors.hpp:89
armnn::ComparisonDescriptor::m_Operation
ComparisonOperation m_Operation
Specifies the comparison operation to execute.
Definition: Descriptors.hpp:105
armnn::ResizeMethod::Bilinear
@ Bilinear
armnn::ComparisonOperation
ComparisonOperation
Definition: Types.hpp:109
Tensor.hpp
armnn::TensorInfo::GetShape
const TensorShape & GetShape() const
Definition: Tensor.hpp:193
armnn::SoftmaxDescriptor::m_Axis
int m_Axis
Scalar, defaulted to the last index (-1), specifying the dimension the activation will be performed o...
Definition: Descriptors.hpp:192
armnn::Convolution3dDescriptor::m_PadBack
uint32_t m_PadBack
Padding back value in the depth dimension.
Definition: Descriptors.hpp:639
armnn::ConvertPaddingModeToAcl
arm_compute::PaddingMode ConvertPaddingModeToAcl(const PaddingMode &paddingMode)
Definition: ArmComputeUtils.hpp:322
armnn::ViewsDescriptor::GetNumDimensions
uint32_t GetNumDimensions() const
Get the number of dimensions.
Definition: Descriptors.cpp:306
armnn::Convolution3dDescriptor::m_DilationY
uint32_t m_DilationY
Dilation along y axis.
Definition: Descriptors.hpp:649
armnn::ActivationFunction::ReLu
@ ReLu
armnn
Copyright (c) 2021 ARM Limited and Contributors.
Definition: 01_00_quick_start.dox:6
armnn::ActivationDescriptor::m_B
float m_B
Beta lower bound value used by the activation functions. (BoundedReLu, Linear, TanH).
Definition: Descriptors.hpp:63
armnn::ConvertNormalizationAlgorithmChannelToAclNormType
arm_compute::NormType ConvertNormalizationAlgorithmChannelToAclNormType(NormalizationAlgorithmChannel channelType)
Definition: ArmComputeUtils.hpp:182
armnn::Convolution3dDescriptor::m_StrideZ
uint32_t m_StrideZ
Stride value when proceeding through input for the depth dimension.
Definition: Descriptors.hpp:645
armnn::ComputeSoftmaxAclAxis
T ComputeSoftmaxAclAxis(const SoftmaxDescriptor &softmaxDesc, const armnn::TensorInfo &tensor)
Definition: ArmComputeUtils.hpp:227
armnn::PoolingAlgorithm::Max
@ Max
armnn::ViewsDescriptor::GetNumViews
uint32_t GetNumViews() const
Get the number of views.
Definition: Descriptors.cpp:301
armnn::ReduceOperation::Min
@ Min
armnn::ComputeReductionTensorShape
const TensorInfo ComputeReductionTensorShape(const armnn::TensorInfo &input, const std::vector< uint32_t > &vAxis, const bool keepDims)
Function to compute the output tensor shape based on the axes and if keepDims is set.
Definition: ArmComputeUtils.hpp:347
armnn::ActivationFunction::Square
@ Square
armnn::PoolingAlgorithm
PoolingAlgorithm
Definition: Types.hpp:150
armnn::OutputShapeRounding::Ceiling
@ Ceiling
armnn::NormalizationAlgorithmChannel
NormalizationAlgorithmChannel
Definition: Types.hpp:207
armnn::ComparisonOperation::Equal
@ Equal
armnn::ReduceDescriptor
A ReduceDescriptor for the REDUCE operators.
Definition: Descriptors.hpp:1538
armnn::PaddingMode::Reflect
@ Reflect
armnn::ConvertFullyConnectedDescriptorToAclFullyConnectedLayerInfo
arm_compute::FullyConnectedLayerInfo ConvertFullyConnectedDescriptorToAclFullyConnectedLayerInfo(const FullyConnectedDescriptor &fullyConnectedDesc, const ActivationDescriptor *activationDesc)
Definition: ArmComputeUtils.hpp:194
armnn::ConvertActivationFunctionToAclActivationFunction
arm_compute::ActivationLayerInfo::ActivationFunction ConvertActivationFunctionToAclActivationFunction(ActivationFunction armnnFunction)
Definition: ArmComputeUtils.hpp:62
armnn::PaddingMode::Constant
@ Constant
armnn::SoftmaxDescriptor
A SoftmaxDescriptor for the SoftmaxLayer.
Definition: Descriptors.hpp:177
armnn::ComputeAclAxis
int ComputeAclAxis(const int &armnnAxis, const armnn::TensorInfo &tensor)
Function to convert ArmNN axis (left to right) to ACL axis (right to left) ranging from [-rank,...
Definition: ArmComputeUtils.hpp:273
armnn::ReduceOperation::Max
@ Max
armnn::DataLayout::NCHW
@ NCHW
armnn::ConvertPoolingAlgorithmToAclPoolingType
arm_compute::PoolingType ConvertPoolingAlgorithmToAclPoolingType(PoolingAlgorithm poolingAlgorithm)
Definition: ArmComputeUtils.hpp:155
armnn::ActivationFunction::Sigmoid
@ Sigmoid
armnn::ComparisonOperation::Greater
@ Greater