ArmNN
 25.11
Loading...
Searching...
No Matches
MockTensorHandleFactory.hpp
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
6#pragma once
7
9#include <armnnTestUtils/MockMemoryManager.hpp>
10
11namespace armnn
12{
13
14constexpr const char* MockTensorHandleFactoryId()
15{
16 return "Arm/Mock/TensorHandleFactory";
17}
18
20{
21
22public:
23 explicit MockTensorHandleFactory(std::shared_ptr<MockMemoryManager> mgr)
24 : m_MemoryManager(mgr)
25 , m_ImportFlags(static_cast<MemorySourceFlags>(MemorySource::Malloc))
26 , m_ExportFlags(static_cast<MemorySourceFlags>(MemorySource::Malloc))
27 {}
28
29 std::unique_ptr<ITensorHandle> CreateSubTensorHandle(ITensorHandle& parent,
30 TensorShape const& subTensorShape,
31 unsigned int const* subTensorOrigin) const override;
32
33 std::unique_ptr<ITensorHandle> CreateTensorHandle(const TensorInfo& tensorInfo) const override;
34
35 std::unique_ptr<ITensorHandle> CreateTensorHandle(const TensorInfo& tensorInfo,
36 DataLayout dataLayout) const override;
37
38 std::unique_ptr<ITensorHandle> CreateTensorHandle(const TensorInfo& tensorInfo,
39 const bool IsMemoryManaged) const override;
40
41 std::unique_ptr<ITensorHandle> CreateTensorHandle(const TensorInfo& tensorInfo,
42 DataLayout dataLayout,
43 const bool IsMemoryManaged) const override;
44
45 static const FactoryId& GetIdStatic();
46
47 const FactoryId& GetId() const override;
48
49 bool SupportsSubTensors() const override;
50
51 MemorySourceFlags GetExportFlags() const override;
52
53 MemorySourceFlags GetImportFlags() const override;
54
55private:
56 mutable std::shared_ptr<MockMemoryManager> m_MemoryManager;
57 MemorySourceFlags m_ImportFlags;
58 MemorySourceFlags m_ExportFlags;
59};
60
61} // 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()
MockTensorHandleFactory(std::shared_ptr< MockMemoryManager > mgr)
Copyright (c) 2021 ARM Limited and Contributors.
MemorySource
Define the Memory Source to reduce copies.
Definition Types.hpp:246
unsigned int MemorySourceFlags
ITensorHandleFactory::FactoryId FactoryId
DataLayout
Definition Types.hpp:63
constexpr const char * MockTensorHandleFactoryId()