ArmNN
 24.08
MockTensorHandleFactory Class Reference

#include <MockTensorHandleFactory.hpp>

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

Public Member Functions

 MockTensorHandleFactory (std::shared_ptr< MockMemoryManager > 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 19 of file MockTensorHandleFactory.hpp.

Constructor & Destructor Documentation

◆ MockTensorHandleFactory()

MockTensorHandleFactory ( std::shared_ptr< MockMemoryManager >  mgr)
inlineexplicit

Definition at line 23 of file MockTensorHandleFactory.hpp.

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

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 20 of file MockTensorHandleFactory.cpp.

23 {
24  return nullptr;
25 }

◆ CreateTensorHandle() [1/4]

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

Implements ITensorHandleFactory.

Definition at line 27 of file MockTensorHandleFactory.cpp.

28 {
29  return std::make_unique<MockTensorHandle>(tensorInfo, m_MemoryManager);
30 }

◆ 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 39 of file MockTensorHandleFactory.cpp.

41 {
42  if (IsMemoryManaged)
43  {
44  return std::make_unique<MockTensorHandle>(tensorInfo, m_MemoryManager);
45  }
46  else
47  {
48  return std::make_unique<MockTensorHandle>(tensorInfo, m_ImportFlags);
49  }
50 }

◆ CreateTensorHandle() [3/4]

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

Implements ITensorHandleFactory.

Definition at line 32 of file MockTensorHandleFactory.cpp.

34 {
35  IgnoreUnused(dataLayout);
36  return std::make_unique<MockTensorHandle>(tensorInfo, m_MemoryManager);
37 }

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 52 of file MockTensorHandleFactory.cpp.

55 {
56  IgnoreUnused(dataLayout);
57  if (IsMemoryManaged)
58  {
59  return std::make_unique<MockTensorHandle>(tensorInfo, m_MemoryManager);
60  }
61  else
62  {
63  return std::make_unique<MockTensorHandle>(tensorInfo, m_ImportFlags);
64  }
65 }

References armnn::IgnoreUnused().

◆ GetExportFlags()

MemorySourceFlags GetExportFlags ( ) const
overridevirtual

Reimplemented from ITensorHandleFactory.

Definition at line 77 of file MockTensorHandleFactory.cpp.

78 {
79  return m_ExportFlags;
80 }

◆ GetId()

const FactoryId & GetId ( ) const
overridevirtual

Implements ITensorHandleFactory.

Definition at line 67 of file MockTensorHandleFactory.cpp.

68 {
69  return GetIdStatic();
70 }

References MockTensorHandleFactory::GetIdStatic().

◆ GetIdStatic()

const FactoryId & GetIdStatic ( )
static

Definition at line 14 of file MockTensorHandleFactory.cpp.

15 {
16  static const FactoryId s_Id(MockTensorHandleFactoryId());
17  return s_Id;
18 }

References armnn::MockTensorHandleFactoryId().

Referenced by MockTensorHandleFactory::GetId().

◆ GetImportFlags()

MemorySourceFlags GetImportFlags ( ) const
overridevirtual

Reimplemented from ITensorHandleFactory.

Definition at line 82 of file MockTensorHandleFactory.cpp.

83 {
84  return m_ImportFlags;
85 }

◆ SupportsSubTensors()

bool SupportsSubTensors ( ) const
overridevirtual

Implements ITensorHandleFactory.

Definition at line 72 of file MockTensorHandleFactory.cpp.

73 {
74  return false;
75 }

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