ArmNN
 24.02
ClImportTensorHandleFactory.hpp
Go to the documentation of this file.
1 //
2 // Copyright © 2021 Arm Ltd. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 #pragma once
6 
11 
12 namespace armnn
13 {
14 
15 constexpr const char* ClImportTensorHandleFactoryId()
16 {
17  return "Arm/Cl/ImportTensorHandleFactory";
18 }
19 
20 /**
21  * This factory creates ClImportTensorHandles that refer to imported memory tensors.
22  */
24 {
25 public:
26  static const FactoryId m_Id;
27 
28  /**
29  * Create a tensor handle factory for tensors that will be imported or exported.
30  *
31  * @param importFlags
32  * @param exportFlags
33  */
35  : m_ImportFlags(importFlags)
36  , m_ExportFlags(exportFlags)
37  {}
38 
39  std::unique_ptr<ITensorHandle> CreateSubTensorHandle(ITensorHandle& parent,
40  const TensorShape& subTensorShape,
41  const unsigned int* subTensorOrigin) const override;
42 
43  std::unique_ptr<ITensorHandle> CreateTensorHandle(const TensorInfo& tensorInfo) const override;
44 
45  std::unique_ptr<ITensorHandle> CreateTensorHandle(const TensorInfo& tensorInfo,
46  DataLayout dataLayout) const override;
47 
48  std::unique_ptr<ITensorHandle> CreateTensorHandle(const TensorInfo& tensorInfo,
49  const bool IsMemoryManaged) const override;
50 
51  std::unique_ptr<ITensorHandle> CreateTensorHandle(const TensorInfo& tensorInfo,
52  DataLayout dataLayout,
53  const bool IsMemoryManaged) const override;
54 
55  static const FactoryId& GetIdStatic();
56 
57  const FactoryId& GetId() const override;
58 
59  bool SupportsSubTensors() const override;
60 
61  bool SupportsMapUnmap() const override;
62 
63  MemorySourceFlags GetExportFlags() const override;
64 
65  MemorySourceFlags GetImportFlags() const override;
66 
67  std::vector<Capability> GetCapabilities(const IConnectableLayer* layer,
68  const IConnectableLayer* connectedLayer,
69  CapabilityClass capabilityClass) override;
70 
71 private:
72  MemorySourceFlags m_ImportFlags;
73  MemorySourceFlags m_ExportFlags;
74 };
75 
76 } // namespace armnn
armnn::DataLayout
DataLayout
Definition: Types.hpp:62
armnn::ClImportTensorHandleFactoryId
constexpr const char * ClImportTensorHandleFactoryId()
Definition: ClImportTensorHandleFactory.hpp:15
armnn::ClImportTensorHandleFactory
This factory creates ClImportTensorHandles that refer to imported memory tensors.
Definition: ClImportTensorHandleFactory.hpp:23
armnn::CapabilityClass
CapabilityClass
Capability class to calculate in the GetCapabilities function so that only the capability in the scop...
Definition: ITensorHandleFactory.hpp:24
armnn::TensorInfo
Definition: Tensor.hpp:152
armnn::MemorySourceFlags
unsigned int MemorySourceFlags
Definition: MemorySources.hpp:15
ITensorHandleFactory.hpp
BaseMemoryManager.hpp
armnn::ITensorHandle
Definition: ITensorHandle.hpp:16
armnn::ClImportTensorHandleFactory::CreateTensorHandle
std::unique_ptr< ITensorHandle > CreateTensorHandle(const TensorInfo &tensorInfo) const override
Definition: ClImportTensorHandleFactory.cpp:56
armnn::ClImportTensorHandleFactory::GetImportFlags
MemorySourceFlags GetImportFlags() const override
Definition: ClImportTensorHandleFactory.cpp:119
armnn::ClImportTensorHandleFactory::GetId
const FactoryId & GetId() const override
Definition: ClImportTensorHandleFactory.cpp:99
armnn::ClImportTensorHandleFactory::GetIdStatic
static const FactoryId & GetIdStatic()
Definition: ClImportTensorHandleFactory.cpp:93
armnn::ClImportTensorHandleFactory::CreateSubTensorHandle
std::unique_ptr< ITensorHandle > CreateSubTensorHandle(ITensorHandle &parent, const TensorShape &subTensorShape, const unsigned int *subTensorOrigin) const override
Definition: ClImportTensorHandleFactory.cpp:20
armnn::TensorShape
Definition: Tensor.hpp:20
armnn::ClImportTensorHandleFactory::m_Id
static const FactoryId m_Id
Definition: ClImportTensorHandleFactory.hpp:26
armnn::FactoryId
ITensorHandleFactory::FactoryId FactoryId
Definition: MockTensorHandleFactory.cpp:12
armnn::ITensorHandleFactory
Definition: ITensorHandleFactory.hpp:46
armnn::ClImportTensorHandleFactory::SupportsSubTensors
bool SupportsSubTensors() const override
Definition: ClImportTensorHandleFactory.cpp:104
armnn::ClImportTensorHandleFactory::ClImportTensorHandleFactory
ClImportTensorHandleFactory(MemorySourceFlags importFlags, MemorySourceFlags exportFlags)
Create a tensor handle factory for tensors that will be imported or exported.
Definition: ClImportTensorHandleFactory.hpp:34
armnn
Copyright (c) 2021 ARM Limited and Contributors.
Definition: 01_00_quick_start.dox:6
armnn::ClImportTensorHandleFactory::GetExportFlags
MemorySourceFlags GetExportFlags() const override
Definition: ClImportTensorHandleFactory.cpp:114
armnn::IConnectableLayer
Interface for a layer that is connectable to other layers via InputSlots and OutputSlots.
Definition: INetwork.hpp:80
armnn::ClImportTensorHandleFactory::GetCapabilities
std::vector< Capability > GetCapabilities(const IConnectableLayer *layer, const IConnectableLayer *connectedLayer, CapabilityClass capabilityClass) override
Definition: ClImportTensorHandleFactory.cpp:124
MemorySources.hpp
armnn::ClImportTensorHandleFactory::SupportsMapUnmap
bool SupportsMapUnmap() const override
Definition: ClImportTensorHandleFactory.cpp:109
IMemoryManager.hpp