ArmNN
 22.08
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 
8 
9 namespace 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 
27 std::unique_ptr<ITensorHandle> MockTensorHandleFactory::CreateTensorHandle(const TensorInfo& tensorInfo) const
28 {
29  return std::make_unique<MockTensorHandle>(tensorInfo, m_MemoryManager);
30 }
31 
32 std::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 
39 std::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 
52 std::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
DataLayout
Definition: Types.hpp:62
static const FactoryId & GetIdStatic()
MemorySourceFlags GetImportFlags() const override
unsigned int MemorySourceFlags
Copyright (c) 2021 ARM Limited and Contributors.
void IgnoreUnused(Ts &&...)
std::unique_ptr< ITensorHandle > CreateTensorHandle(const TensorInfo &tensorInfo) const override
constexpr const char * MockTensorHandleFactoryId()
ITensorHandleFactory::FactoryId FactoryId
const FactoryId & GetId() const override
MemorySourceFlags GetExportFlags() const override
std::unique_ptr< ITensorHandle > CreateSubTensorHandle(ITensorHandle &parent, TensorShape const &subTensorShape, unsigned int const *subTensorOrigin) const override