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