ArmNN
 22.05
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
Interface for a layer that is connectable to other layers via InputSlots and OutputSlots.
Definition: INetwork.hpp:66
DataLayout
Definition: Types.hpp:62
MemorySourceFlags GetImportFlags() const override
CapabilityClass
Capability class to calculate in the GetCapabilities function so that only the capability in the scop...
std::unique_ptr< ITensorHandle > CreateTensorHandle(const TensorInfo &tensorInfo) const override
unsigned int MemorySourceFlags
Copyright (c) 2021 ARM Limited and Contributors.
const std::set< armnn::LayerType > paddingRequiredLayers
const FactoryId & GetId() const override
MemorySourceFlags GetExportFlags() const override
constexpr const char * NeonTensorHandleFactoryId()
std::vector< Capability > GetCapabilities(const IConnectableLayer *layer, const IConnectableLayer *connectedLayer, CapabilityClass capabilityClass) override
NeonTensorHandleFactory(std::weak_ptr< NeonMemoryManager > mgr)
MemorySource
Define the Memory Source to reduce copies.
Definition: Types.hpp:230
bool SupportsInPlaceComputation() const override
static const FactoryId & GetIdStatic()
std::unique_ptr< ITensorHandle > CreateSubTensorHandle(ITensorHandle &parent, const TensorShape &subTensorShape, const unsigned int *subTensorOrigin) const override