ArmNN
 25.11
Loading...
Searching...
No Matches
MockTensorHandleFactory.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
7#include <armnnTestUtils/MockTensorHandle.hpp>
8
9namespace armnn
10{
11
13
15{
16 static const FactoryId s_Id(MockTensorHandleFactoryId());
17 return s_Id;
18}
19
21 TensorShape const&,
22 unsigned int const*) const
23{
24 return nullptr;
25}
26
27std::unique_ptr<ITensorHandle> MockTensorHandleFactory::CreateTensorHandle(const TensorInfo& tensorInfo) const
28{
29 return std::make_unique<MockTensorHandle>(tensorInfo, m_MemoryManager);
30}
31
32std::unique_ptr<ITensorHandle> MockTensorHandleFactory::CreateTensorHandle(const TensorInfo& tensorInfo,
33 DataLayout dataLayout) const
34{
35 IgnoreUnused(dataLayout);
36 return std::make_unique<MockTensorHandle>(tensorInfo, m_MemoryManager);
37}
38
39std::unique_ptr<ITensorHandle> MockTensorHandleFactory::CreateTensorHandle(const TensorInfo& tensorInfo,
40 const bool IsMemoryManaged) const
41{
42 if (IsMemoryManaged)
43 {
44 return std::make_unique<MockTensorHandle>(tensorInfo, m_MemoryManager);
45 }
46 else
47 {
48 return std::make_unique<MockTensorHandle>(tensorInfo, m_ImportFlags);
49 }
50}
51
52std::unique_ptr<ITensorHandle> MockTensorHandleFactory::CreateTensorHandle(const TensorInfo& tensorInfo,
53 DataLayout dataLayout,
54 const bool IsMemoryManaged) const
55{
56 IgnoreUnused(dataLayout);
57 if (IsMemoryManaged)
58 {
59 return std::make_unique<MockTensorHandle>(tensorInfo, m_MemoryManager);
60 }
61 else
62 {
63 return std::make_unique<MockTensorHandle>(tensorInfo, m_ImportFlags);
64 }
65}
66
68{
69 return GetIdStatic();
70}
71
73{
74 return false;
75}
76
78{
79 return m_ExportFlags;
80}
81
83{
84 return m_ImportFlags;
85}
86
87} // 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
DataLayout
Definition Types.hpp:63
constexpr const char * MockTensorHandleFactoryId()
void IgnoreUnused(Ts &&...)