ArmNN
 24.02
SampleDynamicTensorHandleFactory Class Reference

#include <SampleDynamicTensorHandleFactory.hpp>

Inheritance diagram for SampleDynamicTensorHandleFactory:
[legend]
Collaboration diagram for SampleDynamicTensorHandleFactory:
[legend]

Public Member Functions

 SampleDynamicTensorHandleFactory (std::shared_ptr< SampleMemoryManager > mgr)
 
std::unique_ptr< armnn::ITensorHandleCreateSubTensorHandle (armnn::ITensorHandle &parent, armnn::TensorShape const &subTensorShape, unsigned int const *subTensorOrigin) const override
 
std::unique_ptr< armnn::ITensorHandleCreateTensorHandle (const armnn::TensorInfo &tensorInfo) const override
 
std::unique_ptr< armnn::ITensorHandleCreateTensorHandle (const armnn::TensorInfo &tensorInfo, armnn::DataLayout dataLayout) const override
 
std::unique_ptr< armnn::ITensorHandleCreateTensorHandle (const armnn::TensorInfo &tensorInfo, const bool IsMemoryManaged) const override
 Utility Functions for backends which require TensorHandles to have unmanaged memory. More...
 
std::unique_ptr< armnn::ITensorHandleCreateTensorHandle (const armnn::TensorInfo &tensorInfo, armnn::DataLayout dataLayout, const bool IsMemoryManaged) const override
 
const FactoryIdGetId () const override
 
bool SupportsSubTensors () const override
 
armnn::MemorySourceFlags GetExportFlags () const override
 
armnn::MemorySourceFlags GetImportFlags () const override
 
- Public Member Functions inherited from ITensorHandleFactory
virtual ~ITensorHandleFactory ()
 Some TensorHandleFactory decisions are deferred to run-time. More...
 
virtual bool SupportsInPlaceComputation () const
 
virtual bool SupportsMapUnmap () const
 
virtual std::vector< CapabilityGetCapabilities (const IConnectableLayer *layer, const IConnectableLayer *connectedLayer, CapabilityClass capabilityClass)
 

Static Public Member Functions

static const FactoryIdGetIdStatic ()
 

Additional Inherited Members

- Public Types inherited from ITensorHandleFactory
using FactoryId = std::string
 
- Static Public Attributes inherited from ITensorHandleFactory
static const FactoryId LegacyFactoryId = "armnn_legacy_factory"
 
static const FactoryId DeferredFactoryId = "armnn_deferred_factory"
 Use the workload factory to create the tensor handle. More...
 

Detailed Description

Definition at line 17 of file SampleDynamicTensorHandleFactory.hpp.

Constructor & Destructor Documentation

◆ SampleDynamicTensorHandleFactory()

SampleDynamicTensorHandleFactory ( std::shared_ptr< SampleMemoryManager mgr)
inline

Definition at line 21 of file SampleDynamicTensorHandleFactory.hpp.

22  : m_MemoryManager(mgr),
23  m_ImportFlags(static_cast<armnn::MemorySourceFlags>(armnn::MemorySource::Malloc)),
24  m_ExportFlags(static_cast<armnn::MemorySourceFlags>(armnn::MemorySource::Malloc))
25  {}

Member Function Documentation

◆ CreateSubTensorHandle()

std::unique_ptr< armnn::ITensorHandle > CreateSubTensorHandle ( armnn::ITensorHandle parent,
armnn::TensorShape const &  subTensorShape,
unsigned int const *  subTensorOrigin 
) const
overridevirtual

Implements ITensorHandleFactory.

Definition at line 23 of file SampleDynamicTensorHandleFactory.cpp.

26 {
27  IgnoreUnused(parent, subTensorShape, subTensorOrigin);
28  return nullptr;
29 }

References armnn::IgnoreUnused().

◆ CreateTensorHandle() [1/4]

std::unique_ptr< armnn::ITensorHandle > CreateTensorHandle ( const armnn::TensorInfo tensorInfo) const
overridevirtual

Implements ITensorHandleFactory.

Definition at line 31 of file SampleDynamicTensorHandleFactory.cpp.

33 {
34  return std::make_unique<SampleTensorHandle>(tensorInfo, m_MemoryManager);
35 }

◆ CreateTensorHandle() [2/4]

std::unique_ptr< armnn::ITensorHandle > CreateTensorHandle ( const armnn::TensorInfo tensorInfo,
armnn::DataLayout  dataLayout 
) const
overridevirtual

Implements ITensorHandleFactory.

Definition at line 37 of file SampleDynamicTensorHandleFactory.cpp.

40 {
41  IgnoreUnused(dataLayout);
42  return std::make_unique<SampleTensorHandle>(tensorInfo, m_MemoryManager);
43 }

References armnn::IgnoreUnused().

◆ CreateTensorHandle() [3/4]

std::unique_ptr< armnn::ITensorHandle > CreateTensorHandle ( const armnn::TensorInfo tensorInfo,
armnn::DataLayout  dataLayout,
const bool  IsMemoryManaged 
) const
overridevirtual

Reimplemented from ITensorHandleFactory.

Definition at line 59 of file SampleDynamicTensorHandleFactory.cpp.

63 {
64  IgnoreUnused(dataLayout);
65  if (IsMemoryManaged)
66  {
67  return std::make_unique<SampleTensorHandle>(tensorInfo, m_MemoryManager);
68  }
69  else
70  {
71  return std::make_unique<SampleTensorHandle>(tensorInfo, m_ImportFlags);
72  }
73 }

References armnn::IgnoreUnused().

◆ CreateTensorHandle() [4/4]

std::unique_ptr< armnn::ITensorHandle > CreateTensorHandle ( const armnn::TensorInfo tensorInfo,
const bool  IsMemoryManaged 
) const
overridevirtual

Utility Functions for backends which require TensorHandles to have unmanaged memory.

These should be overloaded if required to facilitate direct import of input tensors and direct export of output tensors.

Reimplemented from ITensorHandleFactory.

Definition at line 45 of file SampleDynamicTensorHandleFactory.cpp.

48 {
49  if (IsMemoryManaged)
50  {
51  return std::make_unique<SampleTensorHandle>(tensorInfo, m_MemoryManager);
52  }
53  else
54  {
55  return std::make_unique<SampleTensorHandle>(tensorInfo, m_ImportFlags);
56  }
57 }

◆ GetExportFlags()

armnn::MemorySourceFlags GetExportFlags ( ) const
overridevirtual

Reimplemented from ITensorHandleFactory.

Definition at line 85 of file SampleDynamicTensorHandleFactory.cpp.

86 {
87  return m_ExportFlags;
88 }

◆ GetId()

const FactoryId & GetId ( ) const
overridevirtual

Implements ITensorHandleFactory.

Definition at line 75 of file SampleDynamicTensorHandleFactory.cpp.

76 {
77  return GetIdStatic();
78 }

References SampleDynamicTensorHandleFactory::GetIdStatic().

◆ GetIdStatic()

const FactoryId & GetIdStatic ( )
static

Definition at line 16 of file SampleDynamicTensorHandleFactory.cpp.

17 {
18  static const FactoryId s_Id(SampleDynamicTensorHandleFactoryId());
19  return s_Id;
20 }

References sdb::SampleDynamicTensorHandleFactoryId().

Referenced by SampleDynamicTensorHandleFactory::GetId().

◆ GetImportFlags()

armnn::MemorySourceFlags GetImportFlags ( ) const
overridevirtual

Reimplemented from ITensorHandleFactory.

Definition at line 90 of file SampleDynamicTensorHandleFactory.cpp.

91 {
92  return m_ImportFlags;
93 }

◆ SupportsSubTensors()

bool SupportsSubTensors ( ) const
overridevirtual

Implements ITensorHandleFactory.

Definition at line 80 of file SampleDynamicTensorHandleFactory.cpp.

81 {
82  return false;
83 }

The documentation for this class was generated from the following files:
armnn::MemorySource::Malloc
@ Malloc
armnn::MemorySourceFlags
unsigned int MemorySourceFlags
Definition: MemorySources.hpp:15
sdb::SampleDynamicTensorHandleFactoryId
constexpr const char * SampleDynamicTensorHandleFactoryId()
Definition: SampleDynamicTensorHandleFactory.hpp:15
sdb::SampleDynamicTensorHandleFactory::GetIdStatic
static const FactoryId & GetIdStatic()
Definition: SampleDynamicTensorHandleFactory.cpp:16
armnn::IgnoreUnused
void IgnoreUnused(Ts &&...)
Definition: IgnoreUnused.hpp:14
armnn::ITensorHandleFactory::FactoryId
std::string FactoryId
Definition: ITensorHandleFactory.hpp:49