ArmNN
 24.08
RefTensorHandleFactory.cpp
Go to the documentation of this file.
1 //
2 // Copyright © 2017 Arm Ltd. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
7 #include "RefTensorHandle.hpp"
8 
10 
11 namespace armnn
12 {
13 
15 
17 {
18  static const FactoryId s_Id(RefTensorHandleFactoryId());
19  return s_Id;
20 }
21 
22 std::unique_ptr<ITensorHandle> RefTensorHandleFactory::CreateSubTensorHandle(ITensorHandle& parent,
23  TensorShape const& subTensorShape,
24  unsigned int const* subTensorOrigin) const
25 {
26  IgnoreUnused(parent, subTensorShape, subTensorOrigin);
27  return nullptr;
28 }
29 
30 std::unique_ptr<ITensorHandle> RefTensorHandleFactory::CreateTensorHandle(const TensorInfo& tensorInfo) const
31 {
32  return std::make_unique<RefTensorHandle>(tensorInfo, m_MemoryManager);
33 }
34 
35 std::unique_ptr<ITensorHandle> RefTensorHandleFactory::CreateTensorHandle(const TensorInfo& tensorInfo,
36  DataLayout dataLayout) const
37 {
38  IgnoreUnused(dataLayout);
39  return std::make_unique<RefTensorHandle>(tensorInfo, m_MemoryManager);
40 }
41 
42 std::unique_ptr<ITensorHandle> RefTensorHandleFactory::CreateTensorHandle(const TensorInfo& tensorInfo,
43  const bool IsMemoryManaged) const
44 {
45  if (IsMemoryManaged)
46  {
47  return std::make_unique<RefTensorHandle>(tensorInfo, m_MemoryManager);
48  }
49  else
50  {
51  return std::make_unique<RefTensorHandle>(tensorInfo);
52  }
53 }
54 
55 std::unique_ptr<ITensorHandle> RefTensorHandleFactory::CreateTensorHandle(const TensorInfo& tensorInfo,
56  DataLayout dataLayout,
57  const bool IsMemoryManaged) const
58 {
59  IgnoreUnused(dataLayout);
60  if (IsMemoryManaged)
61  {
62  return std::make_unique<RefTensorHandle>(tensorInfo, m_MemoryManager);
63  }
64  else
65  {
66  return std::make_unique<RefTensorHandle>(tensorInfo);
67  }
68 }
69 
71 {
72  return GetIdStatic();
73 }
74 
76 {
77  return false;
78 }
79 
81 {
82  return m_ExportFlags;
83 }
84 
86 {
87  return m_ImportFlags;
88 }
89 
90 } // namespace armnn
armnn::DataLayout
DataLayout
Definition: Types.hpp:62
armnn::TensorInfo
Definition: Tensor.hpp:152
armnn::RefTensorHandleFactory::GetIdStatic
static const FactoryId & GetIdStatic()
Definition: RefTensorHandleFactory.cpp:16
armnn::MemorySourceFlags
unsigned int MemorySourceFlags
Definition: MemorySources.hpp:15
armnn::ITensorHandle
Definition: ITensorHandle.hpp:16
armnn::RefTensorHandleFactoryId
constexpr const char * RefTensorHandleFactoryId()
Definition: RefTensorHandleFactory.hpp:15
IgnoreUnused.hpp
armnn::RefTensorHandleFactory::SupportsSubTensors
bool SupportsSubTensors() const override
Definition: RefTensorHandleFactory.cpp:75
armnn::TensorShape
Definition: Tensor.hpp:20
armnn::FactoryId
ITensorHandleFactory::FactoryId FactoryId
Definition: MockTensorHandleFactory.cpp:12
armnn::RefTensorHandleFactory::GetImportFlags
MemorySourceFlags GetImportFlags() const override
Definition: RefTensorHandleFactory.cpp:85
armnn::IgnoreUnused
void IgnoreUnused(Ts &&...)
Definition: IgnoreUnused.hpp:14
armnn::RefTensorHandleFactory::CreateTensorHandle
std::unique_ptr< ITensorHandle > CreateTensorHandle(const TensorInfo &tensorInfo) const override
Definition: RefTensorHandleFactory.cpp:30
armnn
Copyright (c) 2021 ARM Limited and Contributors.
Definition: 01_00_quick_start.dox:6
armnn::ITensorHandleFactory::FactoryId
std::string FactoryId
Definition: ITensorHandleFactory.hpp:49
armnn::RefTensorHandleFactory::CreateSubTensorHandle
std::unique_ptr< ITensorHandle > CreateSubTensorHandle(ITensorHandle &parent, TensorShape const &subTensorShape, unsigned int const *subTensorOrigin) const override
Definition: RefTensorHandleFactory.cpp:22
armnn::RefTensorHandleFactory::GetExportFlags
MemorySourceFlags GetExportFlags() const override
Definition: RefTensorHandleFactory.cpp:80
RefTensorHandle.hpp
RefTensorHandleFactory.hpp
armnn::RefTensorHandleFactory::GetId
const FactoryId & GetId() const override
Definition: RefTensorHandleFactory.cpp:70