ArmNN
 24.02
RefTensorHandleFactory Class Reference

#include <RefTensorHandleFactory.hpp>

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

Public Member Functions

 RefTensorHandleFactory (std::shared_ptr< RefMemoryManager > mgr)
 
std::unique_ptr< ITensorHandleCreateSubTensorHandle (ITensorHandle &parent, TensorShape const &subTensorShape, unsigned int const *subTensorOrigin) const override
 
std::unique_ptr< ITensorHandleCreateTensorHandle (const TensorInfo &tensorInfo) const override
 
std::unique_ptr< ITensorHandleCreateTensorHandle (const TensorInfo &tensorInfo, DataLayout dataLayout) const override
 
std::unique_ptr< ITensorHandleCreateTensorHandle (const TensorInfo &tensorInfo, const bool IsMemoryManaged) const override
 Utility Functions for backends which require TensorHandles to have unmanaged memory. More...
 
std::unique_ptr< ITensorHandleCreateTensorHandle (const TensorInfo &tensorInfo, DataLayout dataLayout, const bool IsMemoryManaged) const override
 
const FactoryIdGetId () const override
 
bool SupportsSubTensors () const override
 
MemorySourceFlags GetExportFlags () const override
 
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 RefTensorHandleFactory.hpp.

Constructor & Destructor Documentation

◆ RefTensorHandleFactory()

RefTensorHandleFactory ( std::shared_ptr< RefMemoryManager mgr)
inline

Definition at line 21 of file RefTensorHandleFactory.hpp.

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

References armnn::Malloc.

Member Function Documentation

◆ CreateSubTensorHandle()

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

Implements ITensorHandleFactory.

Definition at line 22 of file RefTensorHandleFactory.cpp.

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

References armnn::IgnoreUnused().

◆ CreateTensorHandle() [1/4]

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

Implements ITensorHandleFactory.

Definition at line 30 of file RefTensorHandleFactory.cpp.

31 {
32  return std::make_unique<RefTensorHandle>(tensorInfo, m_MemoryManager);
33 }

◆ CreateTensorHandle() [2/4]

std::unique_ptr< ITensorHandle > CreateTensorHandle ( const 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 42 of file RefTensorHandleFactory.cpp.

44 {
45  if (IsMemoryManaged)
46  {
47  return std::make_unique<RefTensorHandle>(tensorInfo, m_MemoryManager);
48  }
49  else
50  {
51  return std::make_unique<RefTensorHandle>(tensorInfo);
52  }
53 }

◆ CreateTensorHandle() [3/4]

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

Implements ITensorHandleFactory.

Definition at line 35 of file RefTensorHandleFactory.cpp.

37 {
38  IgnoreUnused(dataLayout);
39  return std::make_unique<RefTensorHandle>(tensorInfo, m_MemoryManager);
40 }

References armnn::IgnoreUnused().

◆ CreateTensorHandle() [4/4]

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

Reimplemented from ITensorHandleFactory.

Definition at line 55 of file RefTensorHandleFactory.cpp.

58 {
59  IgnoreUnused(dataLayout);
60  if (IsMemoryManaged)
61  {
62  return std::make_unique<RefTensorHandle>(tensorInfo, m_MemoryManager);
63  }
64  else
65  {
66  return std::make_unique<RefTensorHandle>(tensorInfo);
67  }
68 }

References armnn::IgnoreUnused().

◆ GetExportFlags()

MemorySourceFlags GetExportFlags ( ) const
overridevirtual

Reimplemented from ITensorHandleFactory.

Definition at line 80 of file RefTensorHandleFactory.cpp.

81 {
82  return m_ExportFlags;
83 }

◆ GetId()

const FactoryId & GetId ( ) const
overridevirtual

Implements ITensorHandleFactory.

Definition at line 70 of file RefTensorHandleFactory.cpp.

71 {
72  return GetIdStatic();
73 }

References RefTensorHandleFactory::GetIdStatic().

◆ GetIdStatic()

const FactoryId & GetIdStatic ( )
static

Definition at line 16 of file RefTensorHandleFactory.cpp.

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

References armnn::RefTensorHandleFactoryId().

Referenced by RefBackend::GetHandleFactoryPreferences(), and RefTensorHandleFactory::GetId().

◆ GetImportFlags()

MemorySourceFlags GetImportFlags ( ) const
overridevirtual

Reimplemented from ITensorHandleFactory.

Definition at line 85 of file RefTensorHandleFactory.cpp.

86 {
87  return m_ImportFlags;
88 }

◆ SupportsSubTensors()

bool SupportsSubTensors ( ) const
overridevirtual

Implements ITensorHandleFactory.

Definition at line 75 of file RefTensorHandleFactory.cpp.

76 {
77  return false;
78 }

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