From 6940dd720ebb6b3d1df8ca203ab696daefe58189 Mon Sep 17 00:00:00 2001 From: Jim Flynn Date: Fri, 20 Mar 2020 12:25:56 +0000 Subject: renamed Documentation folder 20.02 and added .nojekyll file Signed-off-by: Jim Flynn --- ...reference_2workloads_2_gather_8cpp_source.xhtml | 130 +++++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 20.02/backends_2reference_2workloads_2_gather_8cpp_source.xhtml (limited to '20.02/backends_2reference_2workloads_2_gather_8cpp_source.xhtml') diff --git a/20.02/backends_2reference_2workloads_2_gather_8cpp_source.xhtml b/20.02/backends_2reference_2workloads_2_gather_8cpp_source.xhtml new file mode 100644 index 0000000000..f51f7ec934 --- /dev/null +++ b/20.02/backends_2reference_2workloads_2_gather_8cpp_source.xhtml @@ -0,0 +1,130 @@ + + + + + + + + + + + + + +ArmNN: src/backends/reference/workloads/Gather.cpp Source File + + + + + + + + + + + + + + + + +
+
+ + + + ArmNN + + + +
+
+  20.02 +
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+
+
Gather.cpp
+
+
+Go to the documentation of this file.
1 //
2 // Copyright © 2017 Arm Ltd. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
6 #include "Gather.hpp"
7 
8 #include "RefWorkloadUtils.hpp"
9 
12 
13 #include <boost/numeric/conversion/cast.hpp>
14 
15 namespace armnn
16 {
17 
18 void Gather(const TensorInfo& paramsInfo,
19  const TensorInfo& indicesInfo,
20  const TensorInfo& outputInfo,
21  Decoder<float>& params,
22  const int32_t* indices,
23  Encoder<float>& output)
24 {
25  IgnoreUnused(outputInfo);
26  const TensorShape& paramsShape = paramsInfo.GetShape();
27 
28  unsigned int paramsProduct = 1;
29  for (unsigned int i = 1; i < paramsInfo.GetNumDimensions(); ++i)
30  {
31  paramsProduct = paramsProduct * paramsShape[i];
32  }
33 
34  unsigned int outIndex = 0;
35  for (unsigned int i = 0; i < indicesInfo.GetNumElements(); ++i)
36  {
37  unsigned int indx = boost::numeric_cast<unsigned int>(indices[i]);
38 
39  BOOST_ASSERT(indices[i] >= 0 && indx < paramsShape[0]);
40 
41  unsigned int startOffset = indx * paramsProduct;
42  unsigned int endOffset = startOffset + paramsProduct;
43 
44  for (unsigned int j = startOffset; j < endOffset; ++j)
45  {
46  params[j];
47  float outputValue = params.Get();
48  output[outIndex];
49  output.Set(outputValue);
50  ++outIndex;
51  }
52  }
53 
54  BOOST_ASSERT(outIndex == outputInfo.GetNumElements());
55 }
56 
57 } //namespace armnn
+ +
const TensorShape & GetShape() const
Definition: Tensor.hpp:88
+ + +
virtual void Set(IType right)=0
+ +
Copyright (c) 2020 ARM Limited.
+
void IgnoreUnused(Ts &&...)
+ +
virtual IType Get() const =0
+ +
std::enable_if_t< std::is_unsigned< Source >::value &&std::is_unsigned< Dest >::value, Dest > numeric_cast(Source source)
Definition: NumericCast.hpp:33
+
void Gather(const TensorInfo &paramsInfo, const TensorInfo &indicesInfo, const TensorInfo &outputInfo, Decoder< float > &params, const int32_t *indices, Encoder< float > &output)
Definition: Gather.cpp:18
+
unsigned int GetNumDimensions() const
Definition: Tensor.hpp:92
+
unsigned int GetNumElements() const
Definition: Tensor.hpp:93
+ +
+
+ + + + -- cgit v1.2.1