ArmNN  NotReleased
Descriptors.hpp
Go to the documentation of this file.
1 //
2 // Copyright © 2017 Arm Ltd. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 #pragma once
6 
7 #include "Deprecated.hpp"
8 #include "DescriptorsFwd.hpp"
9 
10 #include <cstdint>
11 #include <initializer_list>
12 
13 #include "Tensor.hpp"
14 #include "Types.hpp"
15 
16 namespace armnn
17 {
18 
21 {
24  , m_A(0)
25  , m_B(0)
26  {}
27 
28  bool operator ==(const ActivationDescriptor &rhs) const
29  {
30  return m_Function == rhs.m_Function && m_A == rhs.m_B && m_B == rhs.m_B;
31  }
32 
37  float m_A;
39  float m_B;
40 };
41 
44 {
47  , m_Axis(-1)
48  {}
49 
50  bool operator ==(const ArgMinMaxDescriptor &rhs) const
51  {
52  return m_Function == rhs.m_Function && m_Axis == rhs.m_Axis;
53  }
54 
58  int m_Axis;
59 };
60 
63 {
66  {}
67 
69  : m_Operation(operation)
70  {}
71 
72  bool operator ==(const ComparisonDescriptor &rhs) const
73  {
74  return m_Operation == rhs.m_Operation;
75  }
76 
79 };
80 
83 {
86  {}
87 
89  : m_Operation(operation)
90  {}
91 
92  bool operator ==(const ElementwiseUnaryDescriptor &rhs) const
93  {
94  return m_Operation == rhs.m_Operation;
95  }
96 
99 };
100 
103 {
105  : m_DimMappings{}
106  {}
107 
109  : m_DimMappings(dimMappings)
110  {}
111 
112  bool operator ==(const PermuteDescriptor &rhs) const
113  {
114  return m_DimMappings.IsEqual(rhs.m_DimMappings);
115  }
116 
120 };
121 
124 {
126  : m_Beta(1.0f)
127  , m_Axis(-1)
128  {}
129 
130  bool operator ==(const SoftmaxDescriptor& rhs) const
131  {
132  return m_Beta == rhs.m_Beta && m_Axis == rhs.m_Axis;
133  }
134 
136  float m_Beta;
138  int m_Axis;
139 };
140 
143 
148 {
150  OriginsDescriptor(uint32_t numViews, uint32_t numDimensions = 4);
151  OriginsDescriptor(const OriginsDescriptor& other);
153 
155 
156  OriginsDescriptor& operator=(OriginsDescriptor rhs);
157 
158  bool operator ==(const OriginsDescriptor& rhs) const;
159 
163  Status SetViewOriginCoord(uint32_t view, uint32_t coord, uint32_t value);
165  uint32_t GetNumViews() const;
167  uint32_t GetNumDimensions() const;
169  const uint32_t* GetViewOrigin(uint32_t idx) const;
172  void ReorderOrigins(unsigned int* newOrdering, unsigned int numNewOrdering);
174  friend void swap(OriginsDescriptor& first, OriginsDescriptor& second);
176  void SetConcatAxis(unsigned int concatAxis);
178  unsigned int GetConcatAxis() const;
179 
180 private:
181  unsigned int m_ConcatAxis;
182  uint32_t m_NumViews;
183  uint32_t m_NumDimensions;
184  uint32_t** m_ViewOrigins;
185 };
186 
191 {
192  ViewsDescriptor(uint32_t numViews, uint32_t numDimensions = 4);
193  ViewsDescriptor(const ViewsDescriptor& other);
194  ViewsDescriptor();
196 
197  ~ViewsDescriptor();
198 
199  ViewsDescriptor& operator=(ViewsDescriptor rhs);
200 
201  bool operator ==(const ViewsDescriptor& rhs) const;
202 
206  Status SetViewOriginCoord(uint32_t view, uint32_t coord, uint32_t value);
210  Status SetViewSize(uint32_t view, uint32_t coord, uint32_t value);
211 
213  uint32_t GetNumViews() const;
215  uint32_t GetNumDimensions() const;
217  const uint32_t* GetViewOrigin(uint32_t idx) const;
219  const uint32_t* GetViewSizes(uint32_t idx) const;
221  const OriginsDescriptor& GetOrigins() const;
222 
224  friend void swap(ViewsDescriptor& first, ViewsDescriptor& second);
225 private:
226  OriginsDescriptor m_Origins;
227  uint32_t** m_ViewSizes;
228 };
229 
230 template <typename TensorShapeIt>
231 ARMNN_DEPRECATED_MSG("Use CreateDescriptorForConcatenation instead")
233  TensorShapeIt last,
234  unsigned int concatenationDimension)
235 {
236  return CreateDescriptorForConcatenation(first, last, concatenationDimension);
237 }
238 
241 template <typename TensorShapeIt>
243  TensorShapeIt last,
244  unsigned int concatenationDimension)
245 {
246  auto numInputs = std::distance(first, last);
247 
248  if (numInputs < 2)
249  {
250  throw InvalidArgumentException("Concatenation requires at least 2 inputs");
251  }
252 
253  const auto& firstInputShape = *first;
254 
255  const unsigned int numDimensions = firstInputShape.GetNumDimensions();
256  for (auto it = first + 1; it != last; ++it)
257  {
258  if (it->GetNumDimensions() != numDimensions)
259  {
260  throw InvalidArgumentException("All inputs to concatenation must have the same number of dimensions");
261  }
262  }
263 
264  if (concatenationDimension >= numDimensions)
265  {
266  throw InvalidArgumentException("concatenationDimension must be between 0 and the number of dimensions.");
267  }
268 
269  for (auto it = first; it != last; ++it)
270  {
271  for (unsigned int d = 0; d < numDimensions; ++d)
272  {
273  const bool dimSizeOk = (d == concatenationDimension) || (firstInputShape[d] == (*it)[d]);
274  if (!dimSizeOk)
275  {
276  throw InvalidArgumentException("All inputs to concatenation must be the same size along all dimensions "
277  " except the concatenation dimension");
278  }
279  }
280  }
281 
282  OriginsDescriptor viewsDescriptor(static_cast<uint32_t>(numInputs), numDimensions);
283  viewsDescriptor.SetConcatAxis(concatenationDimension);
284 
285  uint32_t viewIndex = 0u;
286  uint32_t coordAlongConcatDim = 0u;
287  for (auto it = first; it != last; ++it)
288  {
289  const auto& inputShape = *it;
290 
291  for (unsigned int i = 0; i < concatenationDimension; ++i)
292  {
293  viewsDescriptor.SetViewOriginCoord(viewIndex, i, 0);
294  }
295 
296  viewsDescriptor.SetViewOriginCoord(viewIndex, concatenationDimension, coordAlongConcatDim);
297  unsigned int dimSize = inputShape[concatenationDimension];
298  coordAlongConcatDim += dimSize;
299 
300 
301  for (unsigned int i = concatenationDimension + 1; i < numDimensions; ++i)
302  {
303  viewsDescriptor.SetViewOriginCoord(viewIndex, i, 0);
304  }
305 
306  ++viewIndex;
307  }
308 
309  return viewsDescriptor;
310 }
311 
314 {
316  : m_PoolType(PoolingAlgorithm::Max)
317  , m_PadLeft(0)
318  , m_PadRight(0)
319  , m_PadTop(0)
320  , m_PadBottom(0)
321  , m_PoolWidth(0)
322  , m_PoolHeight(0)
323  , m_StrideX(0)
324  , m_StrideY(0)
325  , m_OutputShapeRounding(OutputShapeRounding::Floor)
326  , m_PaddingMethod(PaddingMethod::Exclude)
327  , m_DataLayout(DataLayout::NCHW)
328  {}
329 
330  bool operator ==(const Pooling2dDescriptor& rhs) const
331  {
332  return m_PoolType == rhs.m_PoolType &&
333  m_PadLeft == rhs.m_PadLeft &&
334  m_PadRight == rhs.m_PadRight &&
335  m_PadTop == rhs.m_PadTop &&
336  m_PadBottom == rhs.m_PadBottom &&
337  m_PoolWidth == rhs.m_PoolWidth &&
338  m_PoolHeight == rhs.m_PoolHeight &&
339  m_StrideX == rhs.m_StrideX &&
340  m_StrideY == rhs.m_StrideY &&
341  m_OutputShapeRounding == rhs.m_OutputShapeRounding &&
342  m_PaddingMethod == rhs.m_PaddingMethod &&
343  m_DataLayout == rhs.m_DataLayout;
344  }
345 
349  uint32_t m_PadLeft;
351  uint32_t m_PadRight;
353  uint32_t m_PadTop;
355  uint32_t m_PadBottom;
357  uint32_t m_PoolWidth;
359  uint32_t m_PoolHeight;
361  uint32_t m_StrideX;
363  uint32_t m_StrideY;
370 };
371 
374 {
376  : m_BiasEnabled(false)
377  , m_TransposeWeightMatrix(false)
378  {}
379 
380  bool operator ==(const FullyConnectedDescriptor& rhs) const
381  {
382  return m_BiasEnabled == rhs.m_BiasEnabled && m_TransposeWeightMatrix == rhs.m_TransposeWeightMatrix;
383  }
384 
389 };
390 
393 {
395  : m_PadLeft(0)
396  , m_PadRight(0)
397  , m_PadTop(0)
398  , m_PadBottom(0)
399  , m_StrideX(0)
400  , m_StrideY(0)
401  , m_DilationX(1)
402  , m_DilationY(1)
403  , m_BiasEnabled(false)
404  , m_DataLayout(DataLayout::NCHW)
405  {}
406 
407  bool operator ==(const Convolution2dDescriptor& rhs) const
408  {
409  return m_PadLeft == rhs.m_PadLeft &&
410  m_PadRight == rhs.m_PadRight &&
411  m_PadTop == rhs.m_PadTop &&
412  m_PadBottom == rhs.m_PadBottom &&
413  m_StrideX == rhs.m_StrideX &&
414  m_StrideY == rhs.m_StrideY &&
415  m_DilationX == rhs.m_DilationX &&
416  m_DilationY == rhs.m_DilationY &&
417  m_BiasEnabled == rhs.m_BiasEnabled &&
418  m_DataLayout == rhs.m_DataLayout;
419  }
420 
422  uint32_t m_PadLeft;
424  uint32_t m_PadRight;
426  uint32_t m_PadTop;
428  uint32_t m_PadBottom;
430  uint32_t m_StrideX;
432  uint32_t m_StrideY;
434  uint32_t m_DilationX;
436  uint32_t m_DilationY;
441 };
442 
445 {
447  : m_PadLeft(0)
448  , m_PadRight(0)
449  , m_PadTop(0)
450  , m_PadBottom(0)
451  , m_StrideX(0)
452  , m_StrideY(0)
453  , m_DilationX(1)
454  , m_DilationY(1)
455  , m_BiasEnabled(false)
456  , m_DataLayout(DataLayout::NCHW)
457  {}
458 
460  {
461  return m_PadLeft == rhs.m_PadLeft &&
462  m_PadRight == rhs.m_PadRight &&
463  m_PadTop == rhs.m_PadTop &&
464  m_PadBottom == rhs.m_PadBottom &&
465  m_StrideX == rhs.m_StrideX &&
466  m_StrideY == rhs.m_StrideY &&
467  m_DilationX == rhs.m_DilationX &&
468  m_DilationY == rhs.m_DilationY &&
469  m_BiasEnabled == rhs.m_BiasEnabled &&
470  m_DataLayout == rhs.m_DataLayout;
471  }
472 
474  uint32_t m_PadLeft;
476  uint32_t m_PadRight;
478  uint32_t m_PadTop;
480  uint32_t m_PadBottom;
482  uint32_t m_StrideX;
484  uint32_t m_StrideY;
486  uint32_t m_DilationX;
488  uint32_t m_DilationY;
493 };
494 
496 {
498  : m_MaxDetections(0)
499  , m_MaxClassesPerDetection(1)
500  , m_DetectionsPerClass(1)
501  , m_NmsScoreThreshold(0)
502  , m_NmsIouThreshold(0)
503  , m_NumClasses(0)
504  , m_UseRegularNms(false)
505  , m_ScaleX(0)
506  , m_ScaleY(0)
507  , m_ScaleW(0)
508  , m_ScaleH(0)
509  {}
510 
512  {
513  return m_MaxDetections == rhs.m_MaxDetections &&
514  m_MaxClassesPerDetection == rhs.m_MaxClassesPerDetection &&
515  m_DetectionsPerClass == rhs.m_DetectionsPerClass &&
516  m_NmsScoreThreshold == rhs.m_NmsScoreThreshold &&
517  m_NmsIouThreshold == rhs.m_NmsIouThreshold &&
518  m_NumClasses == rhs.m_NumClasses &&
519  m_UseRegularNms == rhs.m_UseRegularNms &&
520  m_ScaleX == rhs.m_ScaleX &&
521  m_ScaleY == rhs.m_ScaleY &&
522  m_ScaleW == rhs.m_ScaleW &&
523  m_ScaleH == rhs.m_ScaleH;
524  }
525 
527  uint32_t m_MaxDetections;
537  uint32_t m_NumClasses;
541  float m_ScaleX;
543  float m_ScaleY;
545  float m_ScaleW;
547  float m_ScaleH;
548 };
549 
552 {
554  : m_NormChannelType(NormalizationAlgorithmChannel::Across)
555  , m_NormMethodType(NormalizationAlgorithmMethod::LocalBrightness)
556  , m_NormSize(0)
557  , m_Alpha(0.f)
558  , m_Beta(0.f)
559  , m_K(0.f)
560  , m_DataLayout(DataLayout::NCHW)
561  {}
562 
563  bool operator ==(const NormalizationDescriptor& rhs) const
564  {
565  return m_NormChannelType == rhs.m_NormChannelType &&
566  m_NormMethodType == rhs.m_NormMethodType &&
567  m_NormSize == rhs.m_NormSize &&
568  m_Alpha == rhs.m_Alpha &&
569  m_Beta == rhs.m_Beta &&
570  m_K == rhs.m_K &&
571  m_DataLayout == rhs.m_DataLayout;
572  }
573 
579  uint32_t m_NormSize;
581  float m_Alpha;
583  float m_Beta;
585  float m_K;
588 };
589 
592 {
594  : m_Eps(1e-12f)
595  , m_DataLayout(DataLayout::NCHW)
596  {}
597 
598  bool operator ==(const L2NormalizationDescriptor& rhs) const
599  {
600  return m_Eps == rhs.m_Eps && m_DataLayout == rhs.m_DataLayout;
601  }
602 
604  float m_Eps;
607 };
608 
611 {
613  : m_Eps(0.0001f)
614  , m_DataLayout(DataLayout::NCHW)
615  {}
616 
618  {
619  return m_Eps == rhs.m_Eps && m_DataLayout == rhs.m_DataLayout;
620  }
621 
623  float m_Eps;
626 };
627 
630 {
632  : m_Gamma(1.0f)
633  , m_Beta(0.0f)
634  , m_Eps(1e-12f)
635  , m_DataLayout(DataLayout::NCHW)
636  {}
637 
639  {
640  return m_Gamma == rhs.m_Gamma &&
641  m_Beta == rhs.m_Beta &&
642  m_Eps == rhs.m_Eps &&
643  m_DataLayout == rhs.m_DataLayout;
644  }
645 
647  float m_Gamma;
649  float m_Beta;
651  float m_Eps;
654 };
655 
658 {
660  : m_BlockShape({1, 1})
661  , m_Crops({{0, 0}, {0, 0}})
662  , m_DataLayout(DataLayout::NCHW)
663  {}
664 
665  BatchToSpaceNdDescriptor(std::vector<unsigned int> blockShape,
666  std::vector<std::pair<unsigned int, unsigned int>> crops)
667  : m_BlockShape(blockShape)
668  , m_Crops(crops)
669  , m_DataLayout(DataLayout::NCHW)
670  {}
671 
672  bool operator ==(const BatchToSpaceNdDescriptor& rhs) const
673  {
674  return m_BlockShape == rhs.m_BlockShape &&
675  m_Crops == rhs.m_Crops &&
676  m_DataLayout == rhs.m_DataLayout;
677  }
678 
680  std::vector<unsigned int> m_BlockShape;
682  std::vector<std::pair<unsigned int, unsigned int>> m_Crops;
685 };
686 
689 {
691  : m_Min(-6.0f)
692  , m_Max(6.0f)
693  {}
694 
696  {
697  return m_Min == rhs.m_Min && m_Max == rhs.m_Max;
698  }
699 
701  float m_Min;
703  float m_Max;
704 };
705 
708 {
710  : m_TargetWidth(0)
711  , m_TargetHeight(0)
712  , m_DataLayout(DataLayout::NCHW)
713  {}
714 
716  uint32_t m_TargetWidth;
718  uint32_t m_TargetHeight;
721 };
722 
725 {
727  : m_TargetWidth(0)
728  , m_TargetHeight(0)
729  , m_Method(ResizeMethod::NearestNeighbor)
730  , m_DataLayout(DataLayout::NCHW)
731  , m_BilinearAlignCorners(false)
732  {}
733 
734  bool operator ==(const ResizeDescriptor& rhs) const
735  {
736  return m_TargetWidth == rhs.m_TargetWidth &&
737  m_TargetHeight == rhs.m_TargetHeight &&
738  m_Method == rhs.m_Method &&
739  m_DataLayout == rhs.m_DataLayout &&
740  m_BilinearAlignCorners == rhs.m_BilinearAlignCorners;
741  }
742 
744  uint32_t m_TargetWidth;
746  uint32_t m_TargetHeight;
754 };
755 
756 
759 {
761  : m_TargetShape()
762  {}
763 
765  : m_TargetShape(shape)
766  {}
767 
768  bool operator ==(const ReshapeDescriptor& rhs) const
769  {
770  return m_TargetShape == rhs.m_TargetShape;
771  }
772 
775 };
776 
779 {
781  : m_BlockShape({1, 1})
782  , m_PadList({{0, 0}, {0, 0}})
783  , m_DataLayout(DataLayout::NCHW)
784  {}
785 
786  SpaceToBatchNdDescriptor(const std::vector<unsigned int>& blockShape,
787  const std::vector<std::pair<unsigned int, unsigned int>>& padList)
788  : m_BlockShape(blockShape)
789  , m_PadList(padList)
790  , m_DataLayout(DataLayout::NCHW)
791  {}
792 
793  bool operator ==(const SpaceToBatchNdDescriptor& rhs) const
794  {
795  return m_BlockShape == rhs.m_BlockShape &&
796  m_PadList == rhs.m_PadList &&
797  m_DataLayout == rhs.m_DataLayout;
798  }
799 
801  std::vector<unsigned int> m_BlockShape;
804  std::vector<std::pair<unsigned int, unsigned int>> m_PadList;
807 };
808 
811 {
814  {}
815 
816  SpaceToDepthDescriptor(unsigned int blockSize, DataLayout dataLayout)
817  : m_BlockSize(blockSize)
818  , m_DataLayout(dataLayout)
819  {}
820 
821  bool operator ==(const SpaceToDepthDescriptor& rhs) const
822  {
823  return m_BlockSize == rhs.m_BlockSize && m_DataLayout == rhs.m_DataLayout;
824  }
825 
827  unsigned int m_BlockSize;
828 
831 };
832 
835 
838 {
840  : m_ActivationFunc(1) // 0: None, 1: Relu, 3: Relu6, 4: Tanh, 6: Sigmoid
841  , m_ClippingThresCell(0.0)
842  , m_ClippingThresProj(0.0)
843  , m_CifgEnabled(true)
844  , m_PeepholeEnabled(false)
845  , m_ProjectionEnabled(false)
846  , m_LayerNormEnabled(false)
847  {}
848 
849  bool operator ==(const LstmDescriptor& rhs) const
850  {
851  return m_ActivationFunc == rhs.m_ActivationFunc &&
852  m_ClippingThresCell == rhs.m_ClippingThresCell &&
853  m_ClippingThresProj == rhs.m_ClippingThresProj &&
854  m_CifgEnabled == rhs.m_CifgEnabled &&
855  m_PeepholeEnabled == rhs.m_PeepholeEnabled &&
856  m_LayerNormEnabled == rhs.m_LayerNormEnabled;
857  }
858 
874 };
875 
878 {
880  : m_Axis()
881  , m_KeepDims(false)
882  {}
883 
884  MeanDescriptor(const std::vector<unsigned int>& axis, bool keepDims)
885  : m_Axis(axis)
886  , m_KeepDims(keepDims)
887  {}
888 
889  bool operator ==(const MeanDescriptor& rhs) const
890  {
891  return m_Axis == rhs.m_Axis && m_KeepDims == rhs.m_KeepDims;
892  }
893 
895  std::vector<unsigned int> m_Axis;
898 };
899 
902 {
903  PadDescriptor() : m_PadValue(0)
904  {}
905 
906  PadDescriptor(const std::vector<std::pair<unsigned int, unsigned int>>& padList, const float& padValue = 0)
907  : m_PadList(padList)
908  , m_PadValue(padValue)
909  {}
910 
911  bool operator ==(const PadDescriptor& rhs) const
912  {
913  return m_PadList == rhs.m_PadList && m_PadValue == rhs.m_PadValue;
914  }
915 
920  std::vector<std::pair<unsigned int, unsigned int>> m_PadList;
921 
923  float m_PadValue;
924 };
925 
928 {
929  SliceDescriptor(const std::vector<unsigned int>& begin, const std::vector<unsigned int>& size)
930  : m_Begin(begin)
931  , m_Size(size)
932  {}
933 
935  {}
936 
937  bool operator ==(const SliceDescriptor& rhs) const
938  {
939  return m_Begin == rhs.m_Begin && m_Size == rhs.m_Size;
940  }
941 
943  std::vector<unsigned int> m_Begin;
944 
946  std::vector<unsigned int> m_Size;
947 };
948 
951 {
953  : m_Axis(0)
954  , m_NumInputs(0)
955  , m_InputShape()
956  {}
957 
958  StackDescriptor(uint32_t axis, uint32_t numInputs, const TensorShape& inputShape)
959  : m_Axis(axis)
960  , m_NumInputs(numInputs)
961  , m_InputShape(inputShape)
962  {}
963 
964  bool operator ==(const StackDescriptor& rhs) const
965  {
966  return m_Axis == rhs.m_Axis &&
967  m_NumInputs == rhs.m_NumInputs &&
968  m_InputShape == rhs.m_InputShape;
969  }
970 
972  uint32_t m_Axis;
974  uint32_t m_NumInputs;
977 };
978 
981 {
983 
984  StandInDescriptor(uint32_t numInputs, uint32_t numOutputs)
985  : m_NumInputs(numInputs)
986  , m_NumOutputs(numOutputs)
987  {}
988 
989  bool operator ==(const StandInDescriptor& rhs) const
990  {
991  return m_NumInputs == rhs.m_NumInputs &&
992  m_NumOutputs == rhs.m_NumOutputs;
993  }
994 
996  uint32_t m_NumInputs = 0;
998  uint32_t m_NumOutputs = 0;
999 };
1000 
1003 {
1004  StridedSliceDescriptor(const std::vector<int>& begin,
1005  const std::vector<int>& end,
1006  const std::vector<int>& stride)
1007  : m_Begin(begin)
1008  , m_End(end)
1009  , m_Stride(stride)
1010  , m_BeginMask(0)
1011  , m_EndMask(0)
1012  , m_ShrinkAxisMask(0)
1013  , m_EllipsisMask(0)
1014  , m_NewAxisMask(0)
1015  , m_DataLayout(DataLayout::NCHW)
1016  {}
1017 
1019  : StridedSliceDescriptor({}, {}, {})
1020  {}
1021 
1022  bool operator ==(const StridedSliceDescriptor& rhs) const
1023  {
1024  return m_Begin == rhs.m_Begin &&
1025  m_End == rhs.m_End &&
1026  m_Stride == rhs.m_Stride &&
1027  m_BeginMask == rhs.m_BeginMask &&
1028  m_EndMask == rhs.m_EndMask &&
1029  m_ShrinkAxisMask == rhs.m_ShrinkAxisMask &&
1030  m_EllipsisMask == rhs.m_EllipsisMask &&
1031  m_NewAxisMask == rhs.m_NewAxisMask &&
1032  m_DataLayout == rhs.m_DataLayout;
1033  }
1034 
1035  int GetStartForAxis(const TensorShape& inputShape, unsigned int axis) const;
1036  int GetStopForAxis(const TensorShape& inputShape,
1037  unsigned int axis,
1038  int startForAxis) const;
1039 
1041  std::vector<int> m_Begin;
1043  std::vector<int> m_End;
1045  std::vector<int> m_Stride;
1046 
1049  int32_t m_BeginMask;
1052  int32_t m_EndMask;
1059  int32_t m_NewAxisMask;
1060 
1063 };
1064 
1067 {
1068  PreCompiledDescriptor(unsigned int numInputSlots = 1u, unsigned int numOutputSlots = 1u)
1069  : m_NumInputSlots(numInputSlots), m_NumOutputSlots(numOutputSlots)
1070  {}
1071 
1072  ~PreCompiledDescriptor() = default;
1073 
1074  unsigned int m_NumInputSlots;
1075  unsigned int m_NumOutputSlots;
1076 };
1077 
1080 {
1082  m_PadLeft(0),
1083  m_PadRight(0),
1084  m_PadTop(0),
1085  m_PadBottom(0),
1086  m_StrideX(0),
1087  m_StrideY(0),
1088  m_BiasEnabled(false),
1089  m_DataLayout(DataLayout::NCHW)
1090  {}
1091 
1093  {
1094  return m_PadLeft == rhs.m_PadLeft &&
1095  m_PadRight == rhs.m_PadRight &&
1096  m_PadTop == rhs.m_PadTop &&
1097  m_PadBottom == rhs.m_PadBottom &&
1098  m_StrideX == rhs.m_StrideX &&
1099  m_StrideY == rhs.m_StrideY &&
1100  m_BiasEnabled == rhs.m_BiasEnabled &&
1101  m_DataLayout == rhs.m_DataLayout;
1102  }
1103 
1105  uint32_t m_PadLeft;
1107  uint32_t m_PadRight;
1109  uint32_t m_PadTop;
1111  uint32_t m_PadBottom;
1113  uint32_t m_StrideX;
1115  uint32_t m_StrideY;
1120 };
1121 
1122 } // namespace armnn
void SetConcatAxis(unsigned int concatAxis)
Set the concatenation axis value.
float m_A
Alpha upper bound value used by the activation functions. (BoundedReLu, Linear, TanH).
Definition: Descriptors.hpp:37
bool m_ProjectionEnabled
Enable/disable the projection layer.
PaddingMethod
Definition: Types.hpp:115
uint32_t m_StrideX
Stride value when proceeding through input for the width dimension.
DataLayout m_DataLayout
The data layout to be used (NCHW, NHWC).
float m_ScaleX
Center size encoding scale x.
OriginsDescriptor CreateDescriptorForConcatenation(TensorShapeIt first, TensorShapeIt last, unsigned int concatenationDimension)
Convenience template to create an OriginsDescriptor to use when creating a ConcatLayer for performing...
uint32_t m_PadBottom
Padding bottom value in the height dimension.
DataLayout m_DataLayout
The data layout to be used (NCHW, NHWC).
ReshapeDescriptor(const TensorShape &shape)
uint32_t m_PadBottom
Padding bottom value in the height dimension.
UnaryOperation m_Operation
Specifies the elementwiseUnary operation to execute.
Definition: Descriptors.hpp:98
uint32_t m_MaxClassesPerDetection
Maximum numbers of classes per detection, used in Fast NMS.
uint32_t m_Axis
0-based axis along which to stack the input tensors.
uint32_t m_PadRight
Padding right value in the width dimension.
A BatchToSpaceNdDescriptor for the BatchToSpaceNdLayer.
uint32_t m_NumClasses
Number of classes.
Status
Definition: Types.hpp:26
uint32_t m_DilationX
Dilation factor value for width dimension.
A NormalizationDescriptor for the NormalizationLayer.
float m_Alpha
Alpha value for the normalization equation.
float m_ScaleW
Center size encoding scale weight.
uint32_t m_PadTop
Padding top value in the height dimension.
uint32_t m_NumOutputs
Number of output tensors.
std::vector< std::pair< unsigned int, unsigned int > > m_PadList
Specifies the padding values for the input dimension: heightPad{top, bottom} widthPad{left, right}.
float m_ClippingThresCell
Clipping threshold value for the cell state.
ResizeMethod
Definition: Types.hpp:100
uint32_t m_PadLeft
Padding left value in the width dimension.
std::vector< int > m_Stride
Stride values for the input that will be sliced.
uint32_t m_PoolHeight
Pooling height value.
uint32_t m_TargetHeight
Target height value.
A FakeQuantizationDescriptor for the FakeQuantizationLayer.
int32_t m_NewAxisMask
New axis mask value. If set, the begin, end and stride is disregarded and a new 1 dimension is insert...
float m_Gamma
Gamma, the scale scalar value applied for the normalized tensor. Defaults to 1.0. ...
std::vector< unsigned int > m_Axis
Values for the dimensions to reduce.
DataLayout m_DataLayout
The data layout to be used (NCHW, NHWC).
DataLayout m_DataLayout
The data layout to be used (NCHW, NHWC).
uint32_t m_PadTop
Padding top value in the height dimension.
bool m_CifgEnabled
Enable/disable cifg (coupled input & forget gate).
A PadDescriptor for the PadLayer.
TensorShape m_InputShape
Required shape of all input tensors.
An ActivationDescriptor for the ActivationLayer.
Definition: Descriptors.hpp:20
ActivationFunction
Definition: Types.hpp:54
OutputShapeRounding
Definition: Types.hpp:137
A BatchNormalizationDescriptor for the BatchNormalizationLayer.
DataLayout::NHWC false
uint32_t m_PadRight
Padding right value in the width dimension.
DataLayout m_DataLayout
The data layout to be used (NCHW, NHWC).
float m_ScaleY
Center size encoding scale y.
PadDescriptor(const std::vector< std::pair< unsigned int, unsigned int >> &padList, const float &padValue=0)
DataLayout::NCHW DataLayout::NCHW DataLayout::NHWC DataLayout::NHWC true
std::vector< int > m_Begin
Begin values for the input that will be sliced.
SliceDescriptor(const std::vector< unsigned int > &begin, const std::vector< unsigned int > &size)
uint32_t m_TargetWidth
Target width value.
DataLayout m_DataLayout
The data layout to be used (NCHW, NHWC).
uint32_t m_PadBottom
Padding bottom value in the height dimension.
DataLayout m_DataLayout
The data layout to be used (NCHW, NHWC).
std::vector< unsigned int > m_BlockShape
Block shape value.
bool m_KeepDims
Enable/disable keep dimensions. If true, then the reduced dimensions that are of length 1 are kept...
uint32_t m_PadTop
Padding top value in the height dimension.
Status SetViewOriginCoord(uint32_t view, uint32_t coord, uint32_t value)
A L2NormalizationDescriptor for the L2NormalizationLayer.
bool m_BiasEnabled
Enable/disable bias.
A ViewsDescriptor for the SplitterLayer. Descriptor to configure the splitting process. Number of Views must be equal to the number of outputs, and their order must match - e.g. first view corresponds to the first output, second view to the second output, etc.
uint32_t m_StrideY
Stride value when proceeding through input for the height dimension.
StackDescriptor(uint32_t axis, uint32_t numInputs, const TensorShape &inputShape)
ArgMinMaxFunction m_Function
Specify if the function is to find Min or Max.
Definition: Descriptors.hpp:56
A SpaceToDepthDescriptor for the SpaceToDepthLayer.
DataLayout m_DataLayout
The data layout to be used (NCHW, NHWC).
MeanDescriptor(const std::vector< unsigned int > &axis, bool keepDims)
Krichevsky 2012: Local Brightness Normalization.
float m_Beta
Exponentiation value.
float m_Beta
Beta, the offset scalar value applied for the normalized tensor. Defaults to 1.0. ...
bool m_UseRegularNms
Use Regular NMS.
A ReshapeDescriptor for the ReshapeLayer.
DataLayout m_DataLayout
The data layout to be used (NCHW, NHWC).
A TransposeConvolution2dDescriptor for the TransposeConvolution2dLayer.
uint32_t m_PadTop
Padding top value in the height dimension.
DataLayout m_DataLayout
The data layout to be used (NCHW, NHWC).
TensorShape m_TargetShape
Target shape value.
PermuteDescriptor(const PermutationVector &dimMappings)
uint32_t m_PadLeft
Padding left value in the width dimension.
int m_Axis
Axis to reduce across the input tensor.
Definition: Descriptors.hpp:58
A ElementwiseUnaryDescriptor for the ElementwiseUnaryLayer.
Definition: Descriptors.hpp:82
uint32_t m_PoolWidth
Pooling width value.
ComparisonOperation
Definition: Types.hpp:74
PoolingAlgorithm
Definition: Types.hpp:93
bool m_PeepholeEnabled
Enable/disable peephole.
uint32_t m_NumInputs
Number of input tensors.
DataLayout m_DataLayout
The data layout to be used (NCHW, NHWC).
float m_NmsIouThreshold
Intersection over union threshold.
uint32_t m_StrideX
Stride value when proceeding through input for the width dimension.
std::vector< unsigned int > m_Begin
Beginning indices of the slice in each dimension.
The padding fields don&#39;t count and are ignored.
uint32_t m_NormSize
Depth radius value.
float m_B
Beta lower bound value used by the activation functions. (BoundedReLu, Linear, TanH).
Definition: Descriptors.hpp:39
uint32_t m_StrideY
Stride value when proceeding through input for the height dimension.
uint32_t m_DetectionsPerClass
Detections per classes, used in Regular NMS.
An LstmDescriptor for the LstmLayer.
std::vector< int > m_End
End values for the input that will be sliced.
uint32_t m_PadLeft
Padding left value in the width dimension.
float m_Beta
Beta value for the normalization equation.
void swap(OriginsDescriptor &first, OriginsDescriptor &second)
An InstanceNormalizationDescriptor for InstanceNormalizationLayer.
SpaceToDepthDescriptor(unsigned int blockSize, DataLayout dataLayout)
A FullyConnectedDescriptor for the FullyConnectedLayer.
StandInDescriptor(uint32_t numInputs, uint32_t numOutputs)
bool m_TransposeWeightMatrix
Enable/disable transpose weight matrix.
StridedSliceDescriptor(const std::vector< int > &begin, const std::vector< int > &end, const std::vector< int > &stride)
float m_Eps
Value to add to the variance. Used to avoid dividing by zero.
NormalizationAlgorithmMethod
Definition: Types.hpp:129
float m_NmsScoreThreshold
NMS score threshold.
PaddingMethod m_PaddingMethod
The padding method to be used. (Exclude, IgnoreValue).
float m_Eps
Epsilon, small scalar value added to variance to avoid dividing by zero. Defaults to 1e-12f...
uint32_t m_PadRight
Padding right value in the width dimension.
bool m_BiasEnabled
Enable/disable bias.
PermutationVector m_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. {0U, 3U, 1U, 2U}.
int32_t m_EllipsisMask
Ellipsis mask value.
OutputShapeRounding m_OutputShapeRounding
The rounding method for the output shape. (Floor, Ceiling).
A StackDescriptor for the StackLayer.
int32_t m_BeginMask
Begin mask value. If set, then the begin is disregarded and the fullest range is used for the dimensi...
PreCompiledDescriptor(unsigned int numInputSlots=1u, unsigned int numOutputSlots=1u)
A ResizeBilinearDescriptor for the ResizeBilinearLayer.
float m_PadValue
Optional value to use for padding, defaults to 0.
uint32_t m_NumInputs
Number of input tensors.
ComparisonDescriptor(ComparisonOperation operation)
Definition: Descriptors.hpp:68
ActivationFunction m_Function
The activation function to use (Sigmoid, TanH, Linear, ReLu, BoundedReLu, SoftReLu, LeakyReLu, Abs, Sqrt, Square).
Definition: Descriptors.hpp:35
std::vector< unsigned int > m_Size
Size of the slice in each dimension.
A SoftmaxDescriptor for the SoftmaxLayer.
SpaceToBatchNdDescriptor(const std::vector< unsigned int > &blockShape, const std::vector< std::pair< unsigned int, unsigned int >> &padList)
uint32_t m_TargetWidth
Target width value.
UnaryOperation
Definition: Types.hpp:84
ElementwiseUnaryDescriptor(UnaryOperation operation)
Definition: Descriptors.hpp:88
NormalizationAlgorithmMethod m_NormMethodType
Normalization method algorithm to use (LocalBrightness, LocalContrast).
uint32_t m_StrideY
Stride value when proceeding through input for the height dimension.
uint32_t m_PadLeft
Padding left value in the width dimension.
DataLayout
Definition: Types.hpp:48
PoolingAlgorithm m_PoolType
The pooling algorithm to use (Max. Average, L2).
uint32_t m_StrideX
Stride value when proceeding through input for the width dimension.
ArgMinMaxFunction
Definition: Types.hpp:68
ComparisonOperation m_Operation
Specifies the comparison operation to execute.
Definition: Descriptors.hpp:78
std::vector< std::pair< unsigned int, unsigned int > > m_PadList
Specifies the padding for input dimension. First is the number of values to add before the tensor in ...
bool m_BiasEnabled
Enable/disable bias.
unsigned int m_BlockSize
Scalar specifying the input block size. It must be >= 1.
float m_K
Kappa value used for the across channel normalization equation.
bool operator==(const ActivationDescriptor &rhs) const
Definition: Descriptors.hpp:28
NormalizationAlgorithmChannel
Definition: Types.hpp:123
A Pooling2dDescriptor for the Pooling2dLayer.
uint32_t m_ActivationFunc
The activation function to use. 0: None, 1: Relu, 3: Relu6, 4: Tanh, 6: Sigmoid.
uint32_t m_DilationY
Dilation along y axis.
A StandInDescriptor for the StandIn layer.
A SliceDescriptor for the SliceLayer.
bool m_LayerNormEnabled
Enable/disable layer normalization.
bool m_BiasEnabled
Enable/disable bias.
BatchToSpaceNdDescriptor(std::vector< unsigned int > blockShape, std::vector< std::pair< unsigned int, unsigned int >> crops)
DataLayout m_DataLayout
The data layout to be used (NCHW, NHWC).
A DepthwiseConvolution2dDescriptor for the DepthwiseConvolution2dLayer.
DataLayout m_DataLayout
The data layout to be used (NCHW, NHWC).
int32_t m_ShrinkAxisMask
Shrink axis mask value. If set, the nth specification shrinks the dimensionality by 1...
bool m_BilinearAlignCorners
Aligned corners for bilinear method.
A PermuteDescriptor for the PermuteLayer.
A Convolution2dDescriptor for the Convolution2dLayer.
uint32_t m_TargetHeight
Target height value.
DetectionPostProcessDescriptor()
A MeanDescriptor for the MeanLayer.
DataLayout m_DataLayout
The data layout to be used (NCHW, NHWC).
uint32_t m_DilationX
Dilation along x axis.
A SpaceToBatchNdDescriptor for the SpaceToBatchNdLayer.
std::vector< std::pair< unsigned int, unsigned int > > m_Crops
The values to crop from the input dimension.
uint32_t m_PadBottom
Padding bottom value in the height dimension.
int m_Axis
Scalar, defaulted to the last index (-1), specifying the dimension the activation will be performed o...
#define ARMNN_DEPRECATED_MSG(message)
Definition: Deprecated.hpp:43
NormalizationAlgorithmChannel m_NormChannelType
Normalization channel algorithm to use (Across, Within).
float m_ClippingThresProj
Clipping threshold value for the projection.
uint32_t m_StrideY
Stride value when proceeding through input for the height dimension.
An ArgMinMaxDescriptor for ArgMinMaxLayer.
Definition: Descriptors.hpp:43
OriginsDescriptor CreateMergerDescriptorForConcatenation(TensorShapeIt first, TensorShapeIt last, unsigned int concatenationDimension)
uint32_t m_StrideX
Stride value when proceeding through input for the width dimension.
float m_ScaleH
Center size encoding scale height.
A PreCompiledDescriptor for the PreCompiledLayer.
int32_t m_EndMask
End mask value. If set, then the end is disregarded and the fullest range is used for the dimension...
A ResizeDescriptor for the ResizeLayer.
float m_Eps
Used to avoid dividing by zero.
A ComparisonDescriptor for the ComparisonLayer.
Definition: Descriptors.hpp:62
std::vector< unsigned int > m_BlockShape
Block shape values.
An OriginsDescriptor for the ConcatLayer. Descriptor to configure the concatenation process...
uint32_t m_DilationY
Dilation factor value for height dimension.
uint32_t m_MaxDetections
Maximum numbers of detections.
A StridedSliceDescriptor for the StridedSliceLayer.
uint32_t m_PadRight
Padding right value in the width dimension.