From 4840dfb7543d66652dc11c5ff39c8f5c1e2f9370 Mon Sep 17 00:00:00 2001 From: Ryan OShea Date: Tue, 25 Aug 2020 12:35:58 +0100 Subject: Updating Doxygen Documentation for 20.08 release Signed-off-by: Ryan OShea Change-Id: I605409f8720de5353feceb161b39f8a5f0598180 --- 20.08/classarmnn_1_1_permutation_vector.xhtml | 465 ++++++++++++++++++++++++++ 1 file changed, 465 insertions(+) create mode 100644 20.08/classarmnn_1_1_permutation_vector.xhtml (limited to '20.08/classarmnn_1_1_permutation_vector.xhtml') diff --git a/20.08/classarmnn_1_1_permutation_vector.xhtml b/20.08/classarmnn_1_1_permutation_vector.xhtml new file mode 100644 index 0000000000..49ff5e1ac0 --- /dev/null +++ b/20.08/classarmnn_1_1_permutation_vector.xhtml @@ -0,0 +1,465 @@ + + + + + + + + + + + + + +ArmNN: PermutationVector Class Reference + + + + + + + + + + + + + + + + +
+
+ + + + ArmNN + + + +
+
+  20.08 +
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+ +
+
PermutationVector Class Reference
+
+
+ +

#include <Types.hpp>

+ + + + + + + + + + +

+Public Types

using ValueType = unsigned int
 
using SizeType = unsigned int
 
using ArrayType = std::array< ValueType, MaxNumOfTensorDimensions >
 
using ConstIterator = typename ArrayType::const_iterator
 
+ + + + + + + + + + + + + + + + + +

+Public Member Functions

 PermutationVector (const ValueType *dimMappings, SizeType numDimMappings)
 
 PermutationVector (std::initializer_list< ValueType > dimMappings)
 
ValueType operator[] (SizeType i) const
 
SizeType GetSize () const
 
ConstIterator begin () const
 
ConstIterator end () const
 
bool IsEqual (const PermutationVector &other) const
 
bool IsInverse (const PermutationVector &other) const
 
+

Detailed Description

+
+

Definition at line 196 of file Types.hpp.

+

Member Typedef Documentation

+ +

◆ ArrayType

+ +
+
+ + + + +
using ArrayType = std::array<ValueType, MaxNumOfTensorDimensions>
+
+ +

Definition at line 201 of file Types.hpp.

+ +
+
+ +

◆ ConstIterator

+ +
+
+ + + + +
using ConstIterator = typename ArrayType::const_iterator
+
+ +

Definition at line 202 of file Types.hpp.

+ +
+
+ +

◆ SizeType

+ +
+
+ + + + +
using SizeType = unsigned int
+
+ +

Definition at line 200 of file Types.hpp.

+ +
+
+ +

◆ ValueType

+ +
+
+ + + + +
using ValueType = unsigned int
+
+ +

Definition at line 199 of file Types.hpp.

+ +
+
+

Constructor & Destructor Documentation

+ +

◆ PermutationVector() [1/2]

+ +
+
+ + + + + + + + + + + + + + + + + + +
PermutationVector (const ValueTypedimMappings,
SizeType numDimMappings 
)
+
+
Parameters
+ + +
dimMappings- Indicates how to translate tensor elements from a given source into the target destination, when source and target potentially have different memory layouts.
+
+
+

E.g. For a 4-d tensor laid out in a memory with the format (Batch Element, Height, Width, Channels), which is to be passed as an input to ArmNN, each source dimension is mapped to the corresponding ArmNN dimension. The Batch dimension remains the same (0 -> 0). The source Height dimension is mapped to the location of the ArmNN Height dimension (1 -> 2). Similar arguments are made for the Width and Channels (2 -> 3 and 3 -> 1). This will lead to m_DimMappings pointing to the following array: [ 0, 2, 3, 1 ].

+

Note that the mapping should be reversed if considering the case of ArmNN 4-d outputs (Batch Element, Channels, Height, Width) being written to a destination with the format mentioned above. We now have 0 -> 0, 2 -> 1, 3 -> 2, 1 -> 3, which, when reordered, lead to the following m_DimMappings contents: [ 0, 3, 1, 2 ].

+ +

Definition at line 20 of file Descriptors.cpp.

+ +

References armnn::MaxNumOfTensorDimensions.

+
21 {
22  // Validation
23 
24  if (numDimMappings > MaxNumOfTensorDimensions)
25  {
26  boost::format fmt("The number of mappings (%1%) cannot be greater "
27  "than the maximum number of dimensions supported (%2%)");
28  throw InvalidArgumentException(boost::str(fmt % numDimMappings % MaxNumOfTensorDimensions));
29  }
30 
31  if ((dimMappings == nullptr) && (numDimMappings != 0))
32  {
33  throw InvalidArgumentException("Dimension mappings must not be NULL if the number of mappings is positive");
34  }
35 
36  for (SizeType i = 0; i < numDimMappings; ++i)
37  {
38  const ValueType dstIndex = dimMappings[i];
39  if (dstIndex >= numDimMappings)
40  {
41  boost::format fmt("Dimension mapping at index %1% is invalid: %2% is outside of the valid range [0,%3%]");
42  throw InvalidArgumentException(boost::str(fmt % i % dstIndex % (numDimMappings - 1)));
43  }
44  }
45 
46  // Validation: Detect duplicates
47  {
48  std::array<bool, MaxNumOfTensorDimensions> observedDims;
49  observedDims.fill(false);
50 
51  for (SizeType i = 0; i < numDimMappings; ++i)
52  {
53  const ValueType dstIndex = dimMappings[i];
54  if (observedDims[dstIndex])
55  {
56  throw InvalidArgumentException("Invalid dimension mappings: Two or more source dimensions are mapped "
57  "to the same output dimension");
58  }
59  observedDims[dstIndex] = true;
60  }
61  }
62 
63  // Initialize
64  for (SizeType i = 0; i < numDimMappings; ++i)
65  {
66  m_DimMappings[i] = dimMappings[i];
67  }
68  m_NumDimMappings = numDimMappings;
69 }
unsigned int ValueType
Definition: Types.hpp:199
+
unsigned int SizeType
Definition: Types.hpp:200
+
constexpr unsigned int MaxNumOfTensorDimensions
Definition: Types.hpp:18
+
+
+
+ +

◆ PermutationVector() [2/2]

+ +
+
+ + + + + + + + +
PermutationVector (std::initializer_list< ValueTypedimMappings)
+
+ +

Definition at line 71 of file Descriptors.cpp.

+
72  : PermutationVector(dimMappings.begin(), boost::numeric_cast<SizeType>(dimMappings.size()))
73 {
74 }
PermutationVector(const ValueType *dimMappings, SizeType numDimMappings)
Definition: Descriptors.cpp:20
+
std::enable_if_t< std::is_unsigned< Source >::value &&std::is_unsigned< Dest >::value, Dest > numeric_cast(Source source)
Definition: NumericCast.hpp:33
+
unsigned int SizeType
Definition: Types.hpp:200
+
+
+
+

Member Function Documentation

+ +

◆ begin()

+ +
+
+ + + + + +
+ + + + + + + +
ConstIterator begin () const
+
+inline
+
+ +

Definition at line 227 of file Types.hpp.

+
227 { return m_DimMappings.begin(); }
+
+
+ +

◆ end()

+ +
+
+ + + + + +
+ + + + + + + +
ConstIterator end () const
+
+inline
+
+ +

Definition at line 228 of file Types.hpp.

+
228 { return m_DimMappings.end(); }
+
+
+ +

◆ GetSize()

+ + + +

◆ IsEqual()

+ +
+
+ + + + + +
+ + + + + + + + +
bool IsEqual (const PermutationVectorother) const
+
+inline
+
+ +

Definition at line 230 of file Types.hpp.

+ +

Referenced by TransposeLayer::IsEqual(), PermuteLayer::IsEqual(), and PermuteInputsForConcat().

+
231  {
232  if (m_NumDimMappings != other.m_NumDimMappings) return false;
233  for (unsigned int i = 0; i < m_NumDimMappings; ++i)
234  {
235  if (m_DimMappings[i] != other.m_DimMappings[i]) return false;
236  }
237  return true;
238  }
+
+
+ +

◆ IsInverse()

+ +
+
+ + + + + +
+ + + + + + + + +
bool IsInverse (const PermutationVectorother) const
+
+inline
+
+ +

Definition at line 240 of file Types.hpp.

+ +

References PermutationVector::GetSize().

+ +

Referenced by TransposeLayer::IsInverse(), and PermuteLayer::IsInverse().

+
241  {
242  bool isInverse = (GetSize() == other.GetSize());
243  for (SizeType i = 0; isInverse && (i < GetSize()); ++i)
244  {
245  isInverse = (m_DimMappings[other.m_DimMappings[i]] == i);
246  }
247  return isInverse;
248  }
SizeType GetSize() const
Definition: Types.hpp:225
+
unsigned int SizeType
Definition: Types.hpp:200
+
+
+
+ +

◆ operator[]()

+ +
+
+ + + + + +
+ + + + + + + + +
ValueType operator[] (SizeType i) const
+
+inline
+
+ +

Definition at line 223 of file Types.hpp.

+
223 { return m_DimMappings.at(i); }
+
+
+
The documentation for this class was generated from the following files: +
+
+ + + + -- cgit v1.2.1