ArmNN
 25.11
Loading...
Searching...
No Matches
RefTensorHandleFactory.hpp
Go to the documentation of this file.
1//
2// Copyright © 2017 Arm Ltd. All rights reserved.
3// SPDX-License-Identifier: MIT
4//
5
6#pragma once
7
9
11
12namespace armnn
13{
14
15constexpr const char * RefTensorHandleFactoryId() { return "Arm/Ref/TensorHandleFactory"; }
16
18{
19
20public:
21 RefTensorHandleFactory(std::shared_ptr<RefMemoryManager> mgr)
22 : m_MemoryManager(mgr),
23 m_ImportFlags(static_cast<MemorySourceFlags>(MemorySource::Malloc)),
24 m_ExportFlags(static_cast<MemorySourceFlags>(MemorySource::Malloc))
25 {}
26
27 std::unique_ptr<ITensorHandle> CreateSubTensorHandle(ITensorHandle& parent,
28 TensorShape const& subTensorShape,
29 unsigned int const* subTensorOrigin) const override;
30
31 std::unique_ptr<ITensorHandle> CreateTensorHandle(const TensorInfo& tensorInfo) const override;
32
33 std::unique_ptr<ITensorHandle> CreateTensorHandle(const TensorInfo& tensorInfo,
34 DataLayout dataLayout) const override;
35
36 std::unique_ptr<ITensorHandle> CreateTensorHandle(const TensorInfo& tensorInfo,
37 const bool IsMemoryManaged) const override;
38
39 std::unique_ptr<ITensorHandle> CreateTensorHandle(const TensorInfo& tensorInfo,
40 DataLayout dataLayout,
41 const bool IsMemoryManaged) const override;
42
43 static const FactoryId& GetIdStatic();
44
45 const FactoryId& GetId() const override;
46
47 bool SupportsSubTensors() const override;
48
49 MemorySourceFlags GetExportFlags() const override;
50
51 MemorySourceFlags GetImportFlags() const override;
52
53private:
54 mutable std::shared_ptr<RefMemoryManager> m_MemoryManager;
55 MemorySourceFlags m_ImportFlags;
56 MemorySourceFlags m_ExportFlags;
57
58};
59
60} // namespace armnn
61
const FactoryId & GetId() const override
std::unique_ptr< ITensorHandle > CreateTensorHandle(const TensorInfo &tensorInfo) const override
MemorySourceFlags GetExportFlags() const override
RefTensorHandleFactory(std::shared_ptr< RefMemoryManager > mgr)
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.
MemorySource
Define the Memory Source to reduce copies.
Definition Types.hpp:246
unsigned int MemorySourceFlags
ITensorHandleFactory::FactoryId FactoryId
constexpr const char * RefTensorHandleFactoryId()
DataLayout
Definition Types.hpp:63