ArmNN
 24.08
SampleDynamicWorkloadFactory Class Reference

#include <SampleDynamicWorkloadFactory.hpp>

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

Public Member Functions

 SampleDynamicWorkloadFactory (const std::shared_ptr< SampleMemoryManager > &memoryManager)
 
 SampleDynamicWorkloadFactory ()
 
 ~SampleDynamicWorkloadFactory ()
 
const armnn::BackendIdGetBackendId () const override
 
bool SupportsSubTensors () const override
 
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 bool IsMemoryManaged=true) const override
 
std::unique_ptr< armnn::ITensorHandleCreateTensorHandle (const armnn::TensorInfo &tensorInfo, armnn::DataLayout dataLayout, const bool IsMemoryManaged=true) const override
 
std::unique_ptr< armnn::IWorkloadCreateAddition (const armnn::AdditionQueueDescriptor &descriptor, const armnn::WorkloadInfo &info) const
 
std::unique_ptr< armnn::IWorkloadCreateInput (const armnn::InputQueueDescriptor &descriptor, const armnn::WorkloadInfo &info) const
 
std::unique_ptr< armnn::IWorkloadCreateOutput (const armnn::OutputQueueDescriptor &descriptor, const armnn::WorkloadInfo &info) const
 
std::unique_ptr< armnn::IWorkloadCreateWorkload (armnn::LayerType type, const armnn::QueueDescriptor &descriptor, const armnn::WorkloadInfo &info) const override
 Backends should implement their own CreateWorkload function with a switch statement. More...
 
- Public Member Functions inherited from IWorkloadFactory
virtual ~IWorkloadFactory ()
 
virtual void AfterWorkloadsCreated ()
 

Static Public Member Functions

static bool IsLayerSupported (const armnn::IConnectableLayer &layer, armnn::Optional< armnn::DataType > dataType, std::string &outReasonIfUnsupported)
 
- Static Public Member Functions inherited from IWorkloadFactory
static bool IsLayerSupported (const BackendId &backendId, const IConnectableLayer &layer, Optional< DataType > dataType, std::string &outReasonIfUnsupported)
 
static bool IsLayerSupported (const IConnectableLayer &layer, Optional< DataType > dataType, std::string &outReasonIfUnsupported)
 
static bool IsLayerSupported (const IConnectableLayer &layer, Optional< DataType > dataType, std::string &outReasonIfUnsupported, const ModelOptions &modelOptions)
 
static bool IsLayerSupported (const BackendId &backendId, const IConnectableLayer &layer, Optional< DataType > dataType, std::string &outReasonIfUnsupported, const ModelOptions &modelOptions)
 

Detailed Description

Definition at line 16 of file SampleDynamicWorkloadFactory.hpp.

Constructor & Destructor Documentation

◆ SampleDynamicWorkloadFactory() [1/2]

SampleDynamicWorkloadFactory ( const std::shared_ptr< SampleMemoryManager > &  memoryManager)
explicit

Definition at line 23 of file SampleDynamicWorkloadFactory.cpp.

24  : m_MemoryManager(memoryManager)
25 {
26 }

◆ SampleDynamicWorkloadFactory() [2/2]

Definition at line 28 of file SampleDynamicWorkloadFactory.cpp.

29  : m_MemoryManager(new SampleMemoryManager())
30 {
31 }

◆ ~SampleDynamicWorkloadFactory()

Definition at line 22 of file SampleDynamicWorkloadFactory.hpp.

22 {}

Member Function Documentation

◆ CreateAddition()

std::unique_ptr< armnn::IWorkload > CreateAddition ( const armnn::AdditionQueueDescriptor descriptor,
const armnn::WorkloadInfo info 
) const

Definition at line 60 of file SampleDynamicWorkloadFactory.cpp.

63 {
64  return std::make_unique<SampleDynamicAdditionWorkload>(descriptor, info);
65 }

◆ CreateInput()

std::unique_ptr< armnn::IWorkload > CreateInput ( const armnn::InputQueueDescriptor descriptor,
const armnn::WorkloadInfo info 
) const

Definition at line 67 of file SampleDynamicWorkloadFactory.cpp.

70 {
71  return std::make_unique<armnn::CopyMemGenericWorkload>(descriptor, info);
72 }

◆ CreateOutput()

std::unique_ptr< armnn::IWorkload > CreateOutput ( const armnn::OutputQueueDescriptor descriptor,
const armnn::WorkloadInfo info 
) const

Definition at line 74 of file SampleDynamicWorkloadFactory.cpp.

77 {
78  return std::make_unique<armnn::CopyMemGenericWorkload>(descriptor, info);
79 }

◆ CreateSubTensorHandle()

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

Implements IWorkloadFactory.

Definition at line 33 of file SampleDynamicWorkloadFactory.hpp.

37  {
38  IgnoreUnused(parent, subTensorShape, subTensorOrigin);
39  return nullptr;
40  }

References armnn::IgnoreUnused().

◆ CreateTensorHandle() [1/2]

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

Implements IWorkloadFactory.

Definition at line 52 of file SampleDynamicWorkloadFactory.cpp.

56 {
57  return std::make_unique<armnn::ScopedTensorHandle>(tensorInfo);
58 }

◆ CreateTensorHandle() [2/2]

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

Implements IWorkloadFactory.

Definition at line 45 of file SampleDynamicWorkloadFactory.cpp.

48 {
49  return std::make_unique<armnn::ScopedTensorHandle>(tensorInfo);
50 }

◆ CreateWorkload()

std::unique_ptr< armnn::IWorkload > CreateWorkload ( armnn::LayerType  type,
const armnn::QueueDescriptor descriptor,
const armnn::WorkloadInfo info 
) const
overridevirtual

Backends should implement their own CreateWorkload function with a switch statement.

The case for the switch should be the LayerType and based on that they will call their specific workload creation functionality.

Implements IWorkloadFactory.

Definition at line 81 of file SampleDynamicWorkloadFactory.cpp.

85 {
86  using namespace armnn;
87  using namespace sdb;
88  switch(type)
89  {
90  case LayerType::Addition:
91  {
92  auto additionQueueDescriptor = PolymorphicDowncast<const AdditionQueueDescriptor*>(&descriptor);
93  return std::make_unique<SampleDynamicAdditionWorkload>(*additionQueueDescriptor, info);
94  }
95  case LayerType::Input:
96  {
97  auto inputQueueDescriptor = PolymorphicDowncast<const InputQueueDescriptor*>(&descriptor);
98  return std::make_unique<CopyMemGenericWorkload>(*inputQueueDescriptor, info);
99  }
100  case LayerType::Output:
101  {
102  auto outputQueueDescriptor = PolymorphicDowncast<const OutputQueueDescriptor*>(&descriptor);
103  return std::make_unique<CopyMemGenericWorkload>(*outputQueueDescriptor, info);
104  }
105  default:
106  return nullptr;
107  }
108 }

References armnn::info.

◆ GetBackendId()

const armnn::BackendId & GetBackendId ( ) const
overridevirtual

Implements IWorkloadFactory.

Definition at line 33 of file SampleDynamicWorkloadFactory.cpp.

34 {
35  return s_Id;
36 }

◆ IsLayerSupported()

bool IsLayerSupported ( const armnn::IConnectableLayer layer,
armnn::Optional< armnn::DataType dataType,
std::string &  outReasonIfUnsupported 
)
static

Definition at line 38 of file SampleDynamicWorkloadFactory.cpp.

41 {
42  return IWorkloadFactory::IsLayerSupported(s_Id, layer, dataType, outReasonIfUnsupported);
43 }

References armnn::IsLayerSupported().

◆ SupportsSubTensors()

bool SupportsSubTensors ( ) const
inlineoverridevirtual

Implements IWorkloadFactory.

Definition at line 30 of file SampleDynamicWorkloadFactory.hpp.

30 { return false; }

The documentation for this class was generated from the following files:
sdb::SampleMemoryManager
Definition: SampleMemoryManager.hpp:16
sdb
Definition: SampleDynamicAdditionWorkload.cpp:11
armnn::IgnoreUnused
void IgnoreUnused(Ts &&...)
Definition: IgnoreUnused.hpp:14
armnn::IsLayerSupported
bool IsLayerSupported(const armnn::Layer *layer)
Definition: MockBackend.cpp:62
armnn
Copyright (c) 2021 ARM Limited and Contributors.
Definition: 01_00_quick_start.dox:6