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_8hpp_source.xhtml | 134 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 134 insertions(+) create mode 100644 21.02/_splitter_8hpp_source.xhtml (limited to '21.02/_splitter_8hpp_source.xhtml') diff --git a/21.02/_splitter_8hpp_source.xhtml b/21.02/_splitter_8hpp_source.xhtml new file mode 100644 index 0000000000..9a837a8ace --- /dev/null +++ b/21.02/_splitter_8hpp_source.xhtml @@ -0,0 +1,134 @@ + + + + + + + + + + + + + +ArmNN: src/backends/reference/workloads/Splitter.hpp Source File + + + + + + + + + + + + + + + + +
+
+ + + + ArmNN + + + +
+
+  21.02 +
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+
+
Splitter.hpp
+
+
+Go to the documentation of this file.
1 //
2 // Copyright © 2017 Arm Ltd. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
6 #pragma once
7 
8 #include "RefWorkloadUtils.hpp"
10 #include <armnn/Tensor.hpp>
11 #include <armnn/utility/Assert.hpp>
12 
13 namespace armnn
14 {
15 
16 template <typename DataType>
18 {
19  const TensorInfo& inputInfo0 = GetTensorInfo(data.m_Inputs[0]);
20 
21  for (unsigned int index = 0; index < inputInfo0.GetNumElements(); ++index)
22  {
23  unsigned int indices[MaxNumOfTensorDimensions] = { 0 };
24 
25  unsigned int indexRemainder = index;
26  unsigned int dimensionStride = inputInfo0.GetNumElements();
27 
28  for (unsigned int i = 0; i<inputInfo0.GetNumDimensions(); i++)
29  {
30  dimensionStride /= inputInfo0.GetShape()[i];
31  indices[i] = indexRemainder / dimensionStride; // Use integer division to round down.
32  indexRemainder -= indices[i] * dimensionStride;
33  }
34 
35  for (unsigned int viewIdx = 0; viewIdx < data.m_ViewOrigins.size(); ++viewIdx)
36  {
37  SplitterQueueDescriptor::ViewOrigin const& view = data.m_ViewOrigins[viewIdx];
38 
39  //Split view extents are defined by the size of (the corresponding) input tensor.
40  const TensorInfo& outputInfo = GetTensorInfo(data.m_Outputs[viewIdx]);
41  ARMNN_ASSERT(outputInfo.GetNumDimensions() == inputInfo0.GetNumDimensions());
42 
43  // Check all dimensions to see if this element is inside the given input view.
44  bool insideView = true;
45  for (unsigned int i = 0; i<outputInfo.GetNumDimensions(); i++)
46  {
47  if (indices[i] < view.m_Origin[i])
48  {
49  insideView = false;
50  }
51  if (indices[i] >= view.m_Origin[i] + outputInfo.GetShape()[i])
52  {
53  insideView = false;
54  }
55  }
56 
57  if (insideView)
58  {
59  unsigned int outIndex = 0;
60  unsigned int dimensionStride = 1;
61 
62  for (unsigned int i = outputInfo.GetNumDimensions(); i-- > 0;)
63  {
64  outIndex += dimensionStride * (indices[i] - view.m_Origin[i]);
65  dimensionStride *= outputInfo.GetShape()[i];
66  }
67 
68  //We are within the view, to copy input data to the output corresponding to this view.
69  DataType* outputData = GetOutputTensorData<DataType>(viewIdx, data);
70  ARMNN_ASSERT(outputData);
71 
72  const DataType* inputData = GetInputTensorData<DataType>(0, data);
73  ARMNN_ASSERT(inputData);
74 
75  outputData[outIndex] = inputData[index];
76  }
77  }
78  }
79 }
80 
81 void Split(const SplitterQueueDescriptor& data);
82 } //namespace armnn
+
void Split(const SplitterQueueDescriptor &data)
Definition: Splitter.cpp:21
+ +
const TensorShape & GetShape() const
Definition: Tensor.hpp:187
+ + + + +
Copyright (c) 2021 ARM Limited and Contributors.
+
DataType
Definition: Types.hpp:32
+
#define ARMNN_ASSERT(COND)
Definition: Assert.hpp:14
+
std::vector< ViewOrigin > m_ViewOrigins
+ +
std::vector< ITensorHandle * > m_Outputs
+
std::vector< ITensorHandle * > m_Inputs
+
const TensorInfo & GetTensorInfo(const ITensorHandle *tensorHandle)
float32 helpers
+
void Splitter(const SplitterQueueDescriptor &data)
Definition: Splitter.hpp:17
+
unsigned int GetNumDimensions() const
Definition: Tensor.hpp:191
+
constexpr unsigned int MaxNumOfTensorDimensions
Definition: Types.hpp:18
+
unsigned int GetNumElements() const
Definition: Tensor.hpp:192
+
std::vector< unsigned int > m_Origin
+
+
+ + + + -- cgit v1.2.1