ArmNN
 24.02
NeonTensorHandleFactory.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 
10 
11 namespace armnn
12 {
13 
14 constexpr const char* NeonTensorHandleFactoryId() { return "Arm/Neon/TensorHandleFactory"; }
15 
16 const std::set<armnn::LayerType> paddingRequiredLayers {
32 };
33 
35 {
36 public:
37  NeonTensorHandleFactory(std::weak_ptr<NeonMemoryManager> mgr)
38  : m_MemoryManager(mgr),
39  m_ImportFlags(static_cast<MemorySourceFlags>(MemorySource::Malloc)),
40  m_ExportFlags(static_cast<MemorySourceFlags>(MemorySource::Malloc))
41  {}
42 
43  std::unique_ptr<ITensorHandle> CreateSubTensorHandle(ITensorHandle& parent,
44  const TensorShape& subTensorShape,
45  const unsigned int* subTensorOrigin) const override;
46 
47  std::unique_ptr<ITensorHandle> CreateTensorHandle(const TensorInfo& tensorInfo) const override;
48 
49  std::unique_ptr<ITensorHandle> CreateTensorHandle(const TensorInfo& tensorInfo,
50  DataLayout dataLayout) const override;
51 
52  std::unique_ptr<ITensorHandle> CreateTensorHandle(const TensorInfo& tensorInfo,
53  const bool IsMemoryManaged) const override;
54 
55  std::unique_ptr<ITensorHandle> CreateTensorHandle(const TensorInfo& tensorInfo,
56  DataLayout dataLayout,
57  const bool IsMemoryManaged = true) const override;
58 
59  static const FactoryId& GetIdStatic();
60 
61  const FactoryId& GetId() const override;
62 
63  bool SupportsInPlaceComputation() const override;
64 
65  bool SupportsSubTensors() const override;
66 
67  MemorySourceFlags GetExportFlags() const override;
68 
69  MemorySourceFlags GetImportFlags() const override;
70 
71  std::vector<Capability> GetCapabilities(const IConnectableLayer* layer,
72  const IConnectableLayer* connectedLayer,
73  CapabilityClass capabilityClass) override;
74 
75 private:
76  mutable std::shared_ptr<NeonMemoryManager> m_MemoryManager;
77  MemorySourceFlags m_ImportFlags;
78  MemorySourceFlags m_ExportFlags;
79 };
80 
81 } // namespace armnn
armnn::MemorySource::Malloc
@ Malloc
armnn::LayerType::Permute
@ Permute
armnn::NeonTensorHandleFactory::GetImportFlags
MemorySourceFlags GetImportFlags() const override
Definition: NeonTensorHandleFactory.cpp:115
armnn::NeonTensorHandleFactory::NeonTensorHandleFactory
NeonTensorHandleFactory(std::weak_ptr< NeonMemoryManager > mgr)
Definition: NeonTensorHandleFactory.hpp:37
armnn::DataLayout
DataLayout
Definition: Types.hpp:62
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::NeonTensorHandleFactory::GetIdStatic
static const FactoryId & GetIdStatic()
Definition: NeonTensorHandleFactory.cpp:89
armnn::MemorySourceFlags
unsigned int MemorySourceFlags
Definition: MemorySources.hpp:15
ITensorHandleFactory.hpp
BaseMemoryManager.hpp
armnn::ITensorHandle
Definition: ITensorHandle.hpp:16
armnn::LayerType::Stack
@ Stack
armnn::NeonTensorHandleFactory::GetId
const FactoryId & GetId() const override
Definition: NeonTensorHandleFactory.cpp:95
armnn::LayerType::QuantizedLstm
@ QuantizedLstm
armnn::NeonTensorHandleFactory::SupportsInPlaceComputation
bool SupportsInPlaceComputation() const override
Definition: NeonTensorHandleFactory.cpp:100
armnn::NeonTensorHandleFactory
Definition: NeonTensorHandleFactory.hpp:34
armnn::TensorShape
Definition: Tensor.hpp:20
armnn::FactoryId
ITensorHandleFactory::FactoryId FactoryId
Definition: MockTensorHandleFactory.cpp:12
armnn::LayerType::TransposeConvolution2d
@ TransposeConvolution2d
armnn::LayerType::Quantize
@ Quantize
armnn::paddingRequiredLayers
const std::set< armnn::LayerType > paddingRequiredLayers
Definition: NeonTensorHandleFactory.hpp:16
armnn::ITensorHandleFactory
Definition: ITensorHandleFactory.hpp:46
armnn::NeonTensorHandleFactoryId
constexpr const char * NeonTensorHandleFactoryId()
Definition: NeonTensorHandleFactory.hpp:14
armnn::LayerType::DepthToSpace
@ DepthToSpace
armnn::NeonTensorHandleFactory::SupportsSubTensors
bool SupportsSubTensors() const override
Definition: NeonTensorHandleFactory.cpp:105
armnn::LayerType::Pooling2d
@ Pooling2d
armnn::NeonTensorHandleFactory::CreateTensorHandle
std::unique_ptr< ITensorHandle > CreateTensorHandle(const TensorInfo &tensorInfo) const override
Definition: NeonTensorHandleFactory.cpp:47
armnn::LayerType::FullyConnected
@ FullyConnected
armnn::LayerType::Gather
@ Gather
armnn::LayerType::DepthwiseConvolution2d
@ DepthwiseConvolution2d
armnn::NeonTensorHandleFactory::GetCapabilities
std::vector< Capability > GetCapabilities(const IConnectableLayer *layer, const IConnectableLayer *connectedLayer, CapabilityClass capabilityClass) override
Definition: NeonTensorHandleFactory.cpp:120
armnn::MemorySource
MemorySource
Define the Memory Source to reduce copies.
Definition: Types.hpp:244
armnn::NeonTensorHandleFactory::CreateSubTensorHandle
std::unique_ptr< ITensorHandle > CreateSubTensorHandle(ITensorHandle &parent, const TensorShape &subTensorShape, const unsigned int *subTensorOrigin) const override
Definition: NeonTensorHandleFactory.cpp:20
armnn
Copyright (c) 2021 ARM Limited and Contributors.
Definition: 01_00_quick_start.dox:6
armnn::LayerType::ArgMinMax
@ ArgMinMax
armnn::LayerType::Mean
@ Mean
armnn::IConnectableLayer
Interface for a layer that is connectable to other layers via InputSlots and OutputSlots.
Definition: INetwork.hpp:80
armnn::LayerType::Convolution2d
@ Convolution2d
armnn::LayerType::Lstm
@ Lstm
armnn::LayerType::Dequantize
@ Dequantize
armnn::NeonTensorHandleFactory::GetExportFlags
MemorySourceFlags GetExportFlags() const override
Definition: NeonTensorHandleFactory.cpp:110