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