ArmNN
 24.08
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 
10 
11 namespace armnn
12 {
13 
14 constexpr const char* ClImportTensorHandleFactoryId()
15 {
16  return "Arm/Cl/ImportTensorHandleFactory";
17 }
18 
19 /**
20  * This factory creates ClImportTensorHandles that refer to imported memory tensors.
21  */
23 {
24 public:
25  static const FactoryId m_Id;
26 
27  /**
28  * Create a tensor handle factory for tensors that will be imported or exported.
29  *
30  * @param importFlags
31  * @param exportFlags
32  */
34  : m_ImportFlags(importFlags)
35  , m_ExportFlags(exportFlags)
36  {}
37 
38  std::unique_ptr<ITensorHandle> CreateSubTensorHandle(ITensorHandle& parent,
39  const TensorShape& subTensorShape,
40  const unsigned int* subTensorOrigin) const override;
41 
42  std::unique_ptr<ITensorHandle> CreateTensorHandle(const TensorInfo& tensorInfo) const override;
43 
44  std::unique_ptr<ITensorHandle> CreateTensorHandle(const TensorInfo& tensorInfo,
45  DataLayout dataLayout) const override;
46 
47  std::unique_ptr<ITensorHandle> CreateTensorHandle(const TensorInfo& tensorInfo,
48  const bool IsMemoryManaged) const override;
49 
50  std::unique_ptr<ITensorHandle> CreateTensorHandle(const TensorInfo& tensorInfo,
51  DataLayout dataLayout,
52  const bool IsMemoryManaged) const override;
53 
54  static const FactoryId& GetIdStatic();
55 
56  const FactoryId& GetId() const override;
57 
58  bool SupportsSubTensors() const override;
59 
60  bool SupportsMapUnmap() const override;
61 
62  MemorySourceFlags GetExportFlags() const override;
63 
64  MemorySourceFlags GetImportFlags() const override;
65 
66  std::vector<Capability> GetCapabilities(const IConnectableLayer* layer,
67  const IConnectableLayer* connectedLayer,
68  CapabilityClass capabilityClass) override;
69 
70 private:
71  MemorySourceFlags m_ImportFlags;
72  MemorySourceFlags m_ExportFlags;
73 };
74 
75 } // namespace armnn
armnn::DataLayout
DataLayout
Definition: Types.hpp:62
armnn::ClImportTensorHandleFactoryId
constexpr const char * ClImportTensorHandleFactoryId()
Definition: ClImportTensorHandleFactory.hpp:14
armnn::ClImportTensorHandleFactory
This factory creates ClImportTensorHandles that refer to imported memory tensors.
Definition: ClImportTensorHandleFactory.hpp:22
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
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:25
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:33
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