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/_cl_tensor_handle_factory_8cpp_source.xhtml | 138 ++++++++++++++++++++++ 1 file changed, 138 insertions(+) create mode 100644 21.02/_cl_tensor_handle_factory_8cpp_source.xhtml (limited to '21.02/_cl_tensor_handle_factory_8cpp_source.xhtml') diff --git a/21.02/_cl_tensor_handle_factory_8cpp_source.xhtml b/21.02/_cl_tensor_handle_factory_8cpp_source.xhtml new file mode 100644 index 0000000000..1e06f75ad1 --- /dev/null +++ b/21.02/_cl_tensor_handle_factory_8cpp_source.xhtml @@ -0,0 +1,138 @@ + + + + + + + + + + + + + +ArmNN: src/backends/cl/ClTensorHandleFactory.cpp Source File + + + + + + + + + + + + + + + + +
+
+ + + + ArmNN + + + +
+
+  21.02 +
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+
+
ClTensorHandleFactory.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 
8 #include "ClTensorHandle.hpp"
9 
12 
13 #include <arm_compute/runtime/CL/CLTensor.h>
14 #include <arm_compute/core/Coordinates.h>
15 #include <arm_compute/runtime/CL/CLSubTensor.h>
16 
17 
18 namespace armnn
19 {
20 
22 
23 std::unique_ptr<ITensorHandle> ClTensorHandleFactory::CreateSubTensorHandle(ITensorHandle& parent,
24  const TensorShape& subTensorShape,
25  const unsigned int* subTensorOrigin) const
26 {
28  arm_compute::TensorShape shape = armcomputetensorutils::BuildArmComputeTensorShape(subTensorShape);
29 
30  coords.set_num_dimensions(subTensorShape.GetNumDimensions());
31  for (unsigned int i = 0; i < subTensorShape.GetNumDimensions(); ++i)
32  {
33  // Arm compute indexes tensor coords in reverse order.
34  unsigned int revertedIndex = subTensorShape.GetNumDimensions() - i - 1;
35  coords.set(i, armnn::numeric_cast<int>(subTensorOrigin[revertedIndex]));
36  }
37 
38  const arm_compute::TensorShape parentShape = armcomputetensorutils::BuildArmComputeTensorShape(
39  parent.GetShape());
40 
41  // In order for ACL to support subtensors the concat axis cannot be on x or y and the values of x and y
42  // must match the parent shapes
43  if (coords.x() != 0 || coords.y() != 0)
44  {
45  return nullptr;
46  }
47  if ((parentShape.x() != shape.x()) || (parentShape.y() != shape.y()))
48  {
49  return nullptr;
50  }
51 
52  if (!::arm_compute::error_on_invalid_subtensor(__func__, __FILE__, __LINE__, parentShape, coords, shape))
53  {
54  return nullptr;
55  }
56 
57  return std::make_unique<ClSubTensorHandle>(
58  PolymorphicDowncast<IClTensorHandle *>(&parent), shape, coords);
59 }
60 
61 std::unique_ptr<ITensorHandle> ClTensorHandleFactory::CreateTensorHandle(const TensorInfo& tensorInfo) const
62 {
63  return ClTensorHandleFactory::CreateTensorHandle(tensorInfo, true);
64 }
65 
66 std::unique_ptr<ITensorHandle> ClTensorHandleFactory::CreateTensorHandle(const TensorInfo& tensorInfo,
67  DataLayout dataLayout) const
68 {
69  return ClTensorHandleFactory::CreateTensorHandle(tensorInfo, dataLayout, true);
70 }
71 
72 std::unique_ptr<ITensorHandle> ClTensorHandleFactory::CreateTensorHandle(const TensorInfo& tensorInfo,
73  const bool IsMemoryManaged) const
74 {
75  std::unique_ptr<ClTensorHandle> tensorHandle = std::make_unique<ClTensorHandle>(tensorInfo);
76  if (!IsMemoryManaged)
77  {
78  ARMNN_LOG(warning) << "ClTensorHandleFactory only has support for memory managed.";
79  }
80  tensorHandle->SetMemoryGroup(m_MemoryManager->GetInterLayerMemoryGroup());
81  return tensorHandle;
82 }
83 
84 std::unique_ptr<ITensorHandle> ClTensorHandleFactory::CreateTensorHandle(const TensorInfo& tensorInfo,
85  DataLayout dataLayout,
86  const bool IsMemoryManaged) const
87 {
88  std::unique_ptr<ClTensorHandle> tensorHandle = std::make_unique<ClTensorHandle>(tensorInfo, dataLayout);
89  if (!IsMemoryManaged)
90  {
91  ARMNN_LOG(warning) << "ClTensorHandleFactory only has support for memory managed.";
92  }
93  tensorHandle->SetMemoryGroup(m_MemoryManager->GetInterLayerMemoryGroup());
94  return tensorHandle;
95 }
96 
98 {
99  static const FactoryId s_Id(ClTensorHandleFactoryId());
100  return s_Id;
101 }
102 
104 {
105  return GetIdStatic();
106 }
107 
109 {
110  return true;
111 }
112 
114 {
115  return m_ExportFlags;
116 }
117 
119 {
120  return m_ImportFlags;
121 }
122 
123 } // namespace armnn
static const FactoryId & GetIdStatic()
+
bool SupportsSubTensors() const override
+
DataLayout
Definition: Types.hpp:50
+ +
MemorySourceFlags GetImportFlags() const override
+
std::array< unsigned int, MaxNumOfTensorDimensions > Coordinates
+
#define ARMNN_LOG(severity)
Definition: Logging.hpp:202
+
unsigned int MemorySourceFlags
+
Copyright (c) 2021 ARM Limited and Contributors.
+ +
std::unique_ptr< ITensorHandle > CreateSubTensorHandle(ITensorHandle &parent, const TensorShape &subTensorShape, const unsigned int *subTensorOrigin) const override
+
MemorySourceFlags GetExportFlags() const override
+ + +
constexpr const char * ClTensorHandleFactoryId()
+
ITensorHandleFactory::FactoryId FactoryId
+
std::unique_ptr< ITensorHandle > CreateTensorHandle(const TensorInfo &tensorInfo) const override
+ + +
virtual TensorShape GetShape() const =0
Get the number of elements for each dimension ordered from slowest iterating dimension to fastest ite...
+ + +
unsigned int GetNumDimensions() const
Function that returns the tensor rank.
Definition: Tensor.cpp:174
+ +
const FactoryId & GetId() const override
+
+
+ + + + -- cgit v1.2.1