From fd627ffaec8fd8801d980b4c91ee7c0607ab6aaf Mon Sep 17 00:00:00 2001 From: Jan Eilers Date: Thu, 25 Feb 2021 17:44:00 +0000 Subject: IVGCVSW-5687 Update Doxygen Docu * Update Doxygen Documentation for 21.02 release Signed-off-by: Jan Eilers Change-Id: I9ed2f9caab038836ea99d7b378d7899fe431a4e5 --- 21.02/_splitter_8cpp_source.xhtml | 137 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 137 insertions(+) create mode 100644 21.02/_splitter_8cpp_source.xhtml (limited to '21.02/_splitter_8cpp_source.xhtml') diff --git a/21.02/_splitter_8cpp_source.xhtml b/21.02/_splitter_8cpp_source.xhtml new file mode 100644 index 0000000000..35f2239756 --- /dev/null +++ b/21.02/_splitter_8cpp_source.xhtml @@ -0,0 +1,137 @@ + + + + + + + + + + + + + +ArmNN: src/backends/reference/workloads/Splitter.cpp Source File + + + + + + + + + + + + + + + + +
+
+ + + + ArmNN + + + +
+
+  21.02 +
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+
+
Splitter.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 "RefWorkloadUtils.hpp"
8 #include <armnn/Tensor.hpp>
10 #include "Splitter.hpp"
11 
12 #include <cmath>
13 #include <limits>
14 
15 #include "Decoders.hpp"
16 #include "Encoders.hpp"
17 
18 namespace armnn
19 {
20 
21 void Split(const SplitterQueueDescriptor& data)
22 {
23  const TensorInfo& inputInfo = GetTensorInfo(data.m_Inputs[0]);
24 
25  std::unique_ptr<Decoder<float>> decoderPtr =
26  MakeDecoder<float>(inputInfo, data.m_Inputs[0]->Map());
27  Decoder<float>& decoder = *decoderPtr;
28 
29  for (unsigned int index = 0; index < inputInfo.GetNumElements(); ++index)
30  {
31  unsigned int indices[MaxNumOfTensorDimensions] = { 0 };
32 
33  unsigned int indexRemainder = index;
34  unsigned int dimensionStride = inputInfo.GetNumElements();
35 
36  for (unsigned int i = 0; i<inputInfo.GetNumDimensions(); i++)
37  {
38  dimensionStride /= inputInfo.GetShape()[i];
39  indices[i] = indexRemainder / dimensionStride; // Use integer division to round down.
40  indexRemainder -= indices[i] * dimensionStride;
41  }
42 
43  for (unsigned int viewIdx = 0; viewIdx < data.m_ViewOrigins.size(); ++viewIdx)
44  {
45  SplitterQueueDescriptor::ViewOrigin const& view = data.m_ViewOrigins[viewIdx];
46 
47  //Split view extents are defined by the size of (the corresponding) input tensor.
48  const TensorInfo& outputInfo = GetTensorInfo(data.m_Outputs[viewIdx]);
49  ARMNN_ASSERT(outputInfo.GetNumDimensions() == inputInfo.GetNumDimensions());
50 
51  // Check all dimensions to see if this element is inside the given input view.
52  bool insideView = true;
53  for (unsigned int i = 0; i<outputInfo.GetNumDimensions(); i++)
54  {
55  if (indices[i] < view.m_Origin[i])
56  {
57  insideView = false;
58  }
59  if (indices[i] >= view.m_Origin[i] + outputInfo.GetShape()[i])
60  {
61  insideView = false;
62  }
63  }
64 
65  if (insideView)
66  {
67  std::unique_ptr<Encoder<float>> encoderPtr =
68  MakeEncoder<float>(outputInfo, data.m_Outputs[viewIdx]->Map());
69  Encoder<float>& encoder = *encoderPtr;
70 
71  unsigned int outIndex = 0;
72  unsigned int dimensionStride = 1;
73  float inputValue = 0.f;
74 
75  for (unsigned int i = outputInfo.GetNumDimensions(); i-- > 0;)
76  {
77  outIndex += dimensionStride * (indices[i] - view.m_Origin[i]);
78  dimensionStride *= outputInfo.GetShape()[i];
79  }
80 
81  decoder += index;
82  inputValue = decoder.Get();
83  decoder -= index;
84 
85  encoder += outIndex;
86  encoder.Set(inputValue);
87  break;
88  }
89  }
90  }
91 }
92 
93 }
+
void Split(const SplitterQueueDescriptor &data)
Definition: Splitter.cpp:21
+ +
const TensorShape & GetShape() const
Definition: Tensor.hpp:187
+ + + + + +
Copyright (c) 2021 ARM Limited and Contributors.
+ +
#define ARMNN_ASSERT(COND)
Definition: Assert.hpp:14
+ + +
std::vector< ViewOrigin > m_ViewOrigins
+ +
virtual IType Get() const =0
+
std::vector< ITensorHandle * > m_Outputs
+
std::vector< ITensorHandle * > m_Inputs
+
const TensorInfo & GetTensorInfo(const ITensorHandle *tensorHandle)
float32 helpers
+
unsigned int GetNumDimensions() const
Definition: Tensor.hpp:191
+
constexpr unsigned int MaxNumOfTensorDimensions
Definition: Types.hpp:18
+
std::vector< unsigned int > m_Origin
+ +
+
+ + + + -- cgit v1.2.1