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