ArmNN
 22.02
ClTensorHandleFactory.hpp
Go to the documentation of this file.
1 //
2 // Copyright © 2017 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* ClTensorHandleFactoryId()
16 {
17  return "Arm/Cl/TensorHandleFactory";
18 }
19 
21 {
22 public:
23  static const FactoryId m_Id;
24 
25  ClTensorHandleFactory(std::shared_ptr<ClMemoryManager> mgr)
26  : m_MemoryManager(mgr)
27  , m_ImportFlags(static_cast<MemorySourceFlags>(MemorySource::Undefined))
28  , m_ExportFlags(static_cast<MemorySourceFlags>(MemorySource::Undefined))
29  {}
30 
31  std::unique_ptr<ITensorHandle> CreateSubTensorHandle(ITensorHandle& parent,
32  const TensorShape& subTensorShape,
33  const unsigned int* subTensorOrigin) const override;
34 
35  std::unique_ptr<ITensorHandle> CreateTensorHandle(const TensorInfo& tensorInfo) const override;
36 
37  std::unique_ptr<ITensorHandle> CreateTensorHandle(const TensorInfo& tensorInfo,
38  DataLayout dataLayout) const override;
39 
40  std::unique_ptr<ITensorHandle> CreateTensorHandle(const TensorInfo& tensorInfo,
41  const bool IsMemoryManaged) const override;
42 
43  std::unique_ptr<ITensorHandle> CreateTensorHandle(const TensorInfo& tensorInfo,
44  DataLayout dataLayout,
45  const bool IsMemoryManaged) const override;
46 
47  static const FactoryId& GetIdStatic();
48 
49  const FactoryId& GetId() const override;
50 
51  bool SupportsSubTensors() const override;
52 
53  MemorySourceFlags GetExportFlags() const override;
54 
55  MemorySourceFlags GetImportFlags() const override;
56 
57 private:
58  mutable std::shared_ptr<ClMemoryManager> m_MemoryManager;
59  MemorySourceFlags m_ImportFlags;
60  MemorySourceFlags m_ExportFlags;
61 };
62 
63 } // namespace armnn
static const FactoryId & GetIdStatic()
bool SupportsSubTensors() const override
DataLayout
Definition: Types.hpp:49
MemorySourceFlags GetImportFlags() const override
ClTensorHandleFactory(std::shared_ptr< ClMemoryManager > mgr)
unsigned int MemorySourceFlags
Copyright (c) 2021 ARM Limited and Contributors.
std::unique_ptr< ITensorHandle > CreateSubTensorHandle(ITensorHandle &parent, const TensorShape &subTensorShape, const unsigned int *subTensorOrigin) const override
MemorySourceFlags GetExportFlags() const override
constexpr const char * ClTensorHandleFactoryId()
ITensorHandleFactory::FactoryId FactoryId
std::unique_ptr< ITensorHandle > CreateTensorHandle(const TensorInfo &tensorInfo) const override
MemorySource
Define the Memory Source to reduce copies.
Definition: Types.hpp:217
const FactoryId & GetId() const override