From 38b600d8abb2c5f7a44511b5deddf441f975d51d Mon Sep 17 00:00:00 2001 From: Nikhil Raj Date: Thu, 15 Feb 2024 15:02:19 +0000 Subject: IVGCVSW-7968 Update Doxygen docu for 24.02 Signed-off-by: Nikhil Raj Change-Id: I8c1e45815c6cf78f80d6f2c0959a5bbba6cd11de --- latest/_resize_8cpp_source.html | 142 ++++++++++++++++++++-------------------- 1 file changed, 72 insertions(+), 70 deletions(-) (limited to 'latest/_resize_8cpp_source.html') diff --git a/latest/_resize_8cpp_source.html b/latest/_resize_8cpp_source.html index 93d40060ac..a2b35f16f4 100644 --- a/latest/_resize_8cpp_source.html +++ b/latest/_resize_8cpp_source.html @@ -36,7 +36,7 @@ ArmNN
-  23.11 +  24.02
@@ -106,66 +106,66 @@ $(document).ready(function(){initNavTree('_resize_8cpp_source.html',''); initRes
9 
-
11 
-
12 #include <cmath>
-
13 #include <algorithm>
-
14 
-
15 using namespace armnnUtils;
-
16 
-
17 namespace armnn
-
18 {
-
19 
-
20 namespace
-
21 {
-
22 
-
23 inline float Lerp(float a, float b, float w)
-
24 {
-
25  return w * b + (1.f - w) * a;
-
26 }
-
27 
-
28 inline double EuclideanDistance(float Xa, float Ya, const unsigned int Xb, const unsigned int Yb)
-
29 {
-
30  return std::sqrt(pow(Xa - armnn::numeric_cast<float>(Xb), 2) + pow(Ya - armnn::numeric_cast<float>(Yb), 2));
-
31 }
-
32 
-
33 inline float CalculateResizeScale(const unsigned int& InputSize,
-
34  const unsigned int& OutputSize,
-
35  const bool& AlignCorners)
-
36 {
-
37  return (AlignCorners && OutputSize > 1)
-
38  ? armnn::numeric_cast<float>(InputSize - 1) / armnn::numeric_cast<float>(OutputSize - 1)
-
39  : armnn::numeric_cast<float>(InputSize) / armnn::numeric_cast<float>(OutputSize);
-
40 }
-
41 
-
42 inline float PixelScaler(const unsigned int& Pixel,
-
43  const float& Scale,
-
44  const bool& HalfPixelCenters,
-
45  armnn::ResizeMethod& resizeMethod)
-
46 {
-
47  // For Half Pixel Centers the Top Left texel is assumed to be at 0.5,0.5
-
48  if (HalfPixelCenters && resizeMethod == armnn::ResizeMethod::Bilinear)
-
49  {
-
50  return (static_cast<float>(Pixel) + 0.5f) * Scale - 0.5f;
-
51  }
-
52  // Nearest Neighbour doesn't need to have 0.5f trimmed off as it will floor the values later
-
53  else if (HalfPixelCenters && resizeMethod == armnn::ResizeMethod::NearestNeighbor)
-
54  {
-
55  return (static_cast<float>(Pixel) + 0.5f) * Scale;
-
56  }
-
57  else
-
58  {
-
59  return static_cast<float>(Pixel) * Scale;
-
60  }
-
61 }
+
11 #include <armnn/Utils.hpp>
+
12 
+
13 #include <cmath>
+
14 #include <algorithm>
+
15 
+
16 using namespace armnnUtils;
+
17 
+
18 namespace
+
19 {
+
20 
+
21 inline float Lerp(float a, float b, float w)
+
22 {
+
23  return w * b + (1.f - w) * a;
+
24 }
+
25 
+
26 inline double EuclideanDistance(float Xa, float Ya, const unsigned int Xb, const unsigned int Yb)
+
27 {
+
28  return std::sqrt(pow(Xa - armnn::numeric_cast<float>(Xb), 2) + pow(Ya - armnn::numeric_cast<float>(Yb), 2));
+
29 }
+
30 
+
31 inline float CalculateResizeScale(const unsigned int& InputSize,
+
32  const unsigned int& OutputSize,
+
33  const bool& AlignCorners)
+
34 {
+
35  return (AlignCorners && OutputSize > 1)
+
36  ? armnn::numeric_cast<float>(InputSize - 1) / armnn::numeric_cast<float>(OutputSize - 1)
+
37  : armnn::numeric_cast<float>(InputSize) / armnn::numeric_cast<float>(OutputSize);
+
38 }
+
39 
+
40 inline float PixelScaler(const unsigned int& Pixel,
+
41  const float& Scale,
+
42  const bool& HalfPixelCenters,
+
43  armnn::ResizeMethod& resizeMethod)
+
44 {
+
45  // For Half Pixel Centers the Top Left texel is assumed to be at 0.5,0.5
+
46  if (HalfPixelCenters && resizeMethod == armnn::ResizeMethod::Bilinear)
+
47  {
+
48  return (static_cast<float>(Pixel) + 0.5f) * Scale - 0.5f;
+
49  }
+
50  // Nearest Neighbour doesn't need to have 0.5f trimmed off as it will floor the values later
+
51  else if (HalfPixelCenters && resizeMethod == armnn::ResizeMethod::NearestNeighbor)
+
52  {
+
53  return (static_cast<float>(Pixel) + 0.5f) * Scale;
+
54  }
+
55  else
+
56  {
+
57  return static_cast<float>(Pixel) * Scale;
+
58  }
+
59 }
+
60 
+
61 }// anonymous namespace
62 
-
63 }// anonymous namespace
-
64 
- +
63 namespace armnn
+
64 {
+
66  const TensorInfo& inputInfo,
67  Encoder<float>& out,
68  const TensorInfo& outputInfo,
69  DataLayoutIndexed dataLayout,
-
70  armnn::ResizeMethod resizeMethod,
+
70  ResizeMethod resizeMethod,
71  bool alignCorners,
72  bool halfPixelCenters)
73 {
@@ -189,8 +189,8 @@ $(document).ready(function(){initNavTree('_resize_8cpp_source.html',''); initRes
91  const float scaleY = CalculateResizeScale(inputHeight, outputHeight, alignCorners);
92  const float scaleX = CalculateResizeScale(inputWidth, outputWidth, alignCorners);
93 
-
94  TensorShape inputShape = inputInfo.GetShape();
-
95  TensorShape outputShape = outputInfo.GetShape();
+
94  const TensorShape& inputShape = inputInfo.GetShape();
+
95  const TensorShape& outputShape = outputInfo.GetShape();
96 
97  for (unsigned int n = 0; n < batchSize; ++n)
98  {
@@ -202,8 +202,8 @@ $(document).ready(function(){initNavTree('_resize_8cpp_source.html',''); initRes
104  float iy = PixelScaler(y, scaleY, halfPixelCenters, resizeMethod);
105 
106  // Discrete height coordinate of top-left texel (in the 2x2 texel area used for interpolation).
-
107  const float fiy = (resizeMethod == armnn::ResizeMethod::NearestNeighbor && alignCorners) ?
-
108  roundf(iy) : floorf(iy);
+
107  const float fiy = (resizeMethod == ResizeMethod::NearestNeighbor && alignCorners) ? armnn::roundf(iy)
+
108  : floorf(iy);
109  // Pixel scaling a value with Half Pixel Centers can be negative, if so set to 0
110  const unsigned int y0 = static_cast<unsigned int>(std::max(fiy, 0.0f));
111 
@@ -216,8 +216,8 @@ $(document).ready(function(){initNavTree('_resize_8cpp_source.html',''); initRes
118  float ix = PixelScaler(x, scaleX, halfPixelCenters, resizeMethod);
119 
120  // Nearest Neighbour uses rounding to align to corners
-
121  const float fix = resizeMethod == armnn::ResizeMethod::NearestNeighbor && alignCorners ?
-
122  roundf(ix) : floorf(ix);
+
121  const float fix = resizeMethod == ResizeMethod::NearestNeighbor && alignCorners ? armnn::roundf(ix)
+
122  : floorf(ix);
123  // Pixel scaling a value with Half Pixel Centers can be negative, if so set to 0
124  const unsigned int x0 = static_cast<unsigned int>(std::max(fix, 0.0f));
125 
@@ -242,7 +242,7 @@ $(document).ready(function(){initNavTree('_resize_8cpp_source.html',''); initRes
144  float interpolatedValue;
145  switch (resizeMethod)
146  {
- +
147  case ResizeMethod::Bilinear:
148  {
149  in[dataLayout.GetIndex(inputShape, n, c, y0, x0)];
150  float input1 = in.Get();
@@ -258,7 +258,7 @@ $(document).ready(function(){initNavTree('_resize_8cpp_source.html',''); initRes
160  interpolatedValue = Lerp(ly0, ly1, yw);
161  break;
162  }
- +
163  case ResizeMethod::NearestNeighbor:
164  {
165  // calculate euclidean distance to the 4 neighbours
166  auto distance00 = EuclideanDistance(fix, fiy, x0, y0);
@@ -293,7 +293,7 @@ $(document).ready(function(){initNavTree('_resize_8cpp_source.html',''); initRes
195  }
196  else
197  {
-
198  throw armnn::InvalidArgumentException("Resize Nearest Neighbor failure");
+
198  throw InvalidArgumentException("Resize Nearest Neighbor failure");
199  }
200 
201  in[dataLayout.GetIndex(inputShape, n, c, yNearest, xNearest)];
@@ -301,8 +301,8 @@ $(document).ready(function(){initNavTree('_resize_8cpp_source.html',''); initRes
203  break;
204  }
205  default:
-
206  throw armnn::InvalidArgumentException("Unknown resize method: " +
-
207  std::to_string(static_cast<int>(resizeMethod)));
+
206  throw InvalidArgumentException("Unknown resize method: " +
+
207  std::to_string(static_cast<int>(resizeMethod)));
208  }
209  out[dataLayout.GetIndex(outputShape, n, c, y, x)];
210  out.Set(interpolatedValue);
@@ -329,14 +329,16 @@ $(document).ready(function(){initNavTree('_resize_8cpp_source.html',''); initRes
unsigned int GetHeightIndex() const
+
unsigned int GetWidthIndex() const
virtual IType Get() const =0
-
void Resize(Decoder< float > &in, const TensorInfo &inputInfo, Encoder< float > &out, const TensorInfo &outputInfo, DataLayoutIndexed dataLayout, armnn::ResizeMethod resizeMethod, bool alignCorners, bool halfPixelCenters)
Definition: Resize.cpp:65
-
const TensorShape & GetShape() const
Definition: Tensor.hpp:191
+
float roundf(float value)
Definition: Utils.hpp:43
+
void Resize(Decoder< float > &in, const TensorInfo &inputInfo, Encoder< float > &out, const TensorInfo &outputInfo, DataLayoutIndexed dataLayout, ResizeMethod resizeMethod, bool alignCorners, bool halfPixelCenters)
Definition: Resize.cpp:65
+
const TensorShape & GetShape() const
Definition: Tensor.hpp:193
Copyright (c) 2021 ARM Limited and Contributors.
unsigned int GetChannelsIndex() const
unsigned int GetIndex(const armnn::TensorShape &shape, unsigned int batchIndex, unsigned int channelIndex, unsigned int heightIndex, unsigned int widthIndex) const
@@ -344,7 +346,7 @@ $(document).ready(function(){initNavTree('_resize_8cpp_source.html',''); initRes