ArmNN
 25.11
Loading...
Searching...
No Matches
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
11namespace armnn
12{
13
15
17{
18 static const FactoryId s_Id(RefTensorHandleFactoryId());
19 return s_Id;
20}
21
22std::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
30std::unique_ptr<ITensorHandle> RefTensorHandleFactory::CreateTensorHandle(const TensorInfo& tensorInfo) const
31{
32 return std::make_unique<RefTensorHandle>(tensorInfo, m_MemoryManager);
33}
34
35std::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
42std::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
55std::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
const FactoryId & GetId() const override
std::unique_ptr< ITensorHandle > CreateTensorHandle(const TensorInfo &tensorInfo) const override
MemorySourceFlags GetExportFlags() const override
MemorySourceFlags GetImportFlags() const override
std::unique_ptr< ITensorHandle > CreateSubTensorHandle(ITensorHandle &parent, TensorShape const &subTensorShape, unsigned int const *subTensorOrigin) const override
static const FactoryId & GetIdStatic()
Copyright (c) 2021 ARM Limited and Contributors.
unsigned int MemorySourceFlags
ITensorHandleFactory::FactoryId FactoryId
constexpr const char * RefTensorHandleFactoryId()
DataLayout
Definition Types.hpp:63
void IgnoreUnused(Ts &&...)