ArmNN
 20.02
PreCompiledLayer Class Reference

#include <PreCompiledLayer.hpp>

Inheritance diagram for PreCompiledLayer:
LayerWithParameters< PreCompiledDescriptor > Layer IConnectableLayer

Public Member Functions

 PreCompiledLayer (const PreCompiledDescriptor &param, const char *name)
 
 ~PreCompiledLayer ()
 
virtual std::unique_ptr< IWorkloadCreateWorkload (const IWorkloadFactory &factory) const override
 
PreCompiledLayerClone (Graph &graph) const override
 Creates a dynamically-allocated copy of this layer. More...
 
void ValidateTensorShapesFromInputs () override
 
void SetPreCompiledObject (PreCompiledObjectPtr preCompiledObject)
 
void Accept (ILayerVisitor &visitor) const override
 Apply a visitor to this layer. More...
 
- Public Member Functions inherited from LayerWithParameters< PreCompiledDescriptor >
const PreCompiledDescriptorGetParameters () const
 
void SerializeLayerParameters (ParameterStringifyFunction &fn) const override
 Helper to serialize the layer parameters to string (currently used in DotSerializer and company). More...
 
- Public Member Functions inherited from Layer
 Layer (unsigned int numInputSlots, unsigned int numOutputSlots, LayerType type, const char *name)
 
 Layer (unsigned int numInputSlots, unsigned int numOutputSlots, LayerType type, DataLayout layout, const char *name)
 
const std::string & GetNameStr () const
 
const OutputHandlerGetOutputHandler (unsigned int i=0) const
 
OutputHandlerGetOutputHandler (unsigned int i=0)
 
const std::vector< InputSlot > & GetInputSlots () const
 
const std::vector< OutputSlot > & GetOutputSlots () const
 
std::vector< InputSlot >::iterator BeginInputSlots ()
 
std::vector< InputSlot >::iterator EndInputSlots ()
 
std::vector< OutputSlot >::iterator BeginOutputSlots ()
 
std::vector< OutputSlot >::iterator EndOutputSlots ()
 
bool IsOutputUnconnected ()
 
void ResetPriority () const
 
LayerPriority GetPriority () const
 
LayerType GetType () const
 
DataType GetDataType () const
 
const BackendIdGetBackendId () const
 
void SetBackendId (const BackendId &id)
 
virtual void CreateTensorHandles (const TensorHandleFactoryRegistry &registry, const IWorkloadFactory &factory, const bool IsMemoryManaged=true)
 
void VerifyLayerConnections (unsigned int expectedConnections, const CheckLocation &location) const
 
std::vector< TensorShapeInferOutputShapes (const std::vector< TensorShape > &inputShapes) const override
 Infer the shape of the output(s) based on the provided input shape(s) More...
 
virtual void ReleaseConstantData ()
 
template<typename Op >
void OperateOnConstantTensors (Op op)
 
const char * GetName () const override
 Returns the name of the layer. More...
 
unsigned int GetNumInputSlots () const override
 Returns the number of connectable input slots. More...
 
unsigned int GetNumOutputSlots () const override
 Returns the number of connectable output slots. More...
 
const InputSlotGetInputSlot (unsigned int index) const override
 Get a const input slot handle by slot index. More...
 
InputSlotGetInputSlot (unsigned int index) override
 Get the input slot handle by slot index. More...
 
const OutputSlotGetOutputSlot (unsigned int index=0) const override
 Get the const output slot handle by slot index. More...
 
OutputSlotGetOutputSlot (unsigned int index=0) override
 Get the output slot handle by slot index. More...
 
void SetGuid (LayerGuid guid)
 
LayerGuid GetGuid () const final
 Returns the unique id of the layer. More...
 
void AddRelatedLayerName (const std::string layerName)
 
const std::list< std::string > & GetRelatedLayerNames ()
 
virtual void Reparent (Graph &dest, std::list< Layer *>::const_iterator iterator)=0
 
void BackendSelectionHint (Optional< BackendId > backend) final
 Provide a hint for the optimizer as to which backend to prefer for this layer. More...
 
Optional< BackendIdGetBackendHint () const
 

Additional Inherited Members

- Public Types inherited from LayerWithParameters< PreCompiledDescriptor >
using DescriptorType = PreCompiledDescriptor
 
- Protected Types inherited from Layer
using ConstantTensors = std::vector< std::reference_wrapper< std::unique_ptr< ScopedCpuTensorHandle > >>
 
- Protected Member Functions inherited from LayerWithParameters< PreCompiledDescriptor >
 LayerWithParameters (unsigned int numInputSlots, unsigned int numOutputSlots, LayerType type, const PreCompiledDescriptor &param, const char *name)
 
 ~LayerWithParameters ()=default
 
WorkloadInfo PrepInfoAndDesc (QueueDescriptor &descriptor) const
 Helper function to reduce duplication in *LayerCreateWorkload. More...
 
- Protected Member Functions inherited from Layer
virtual ~Layer ()=default
 
template<typename QueueDescriptor >
void CollectQueueDescriptorInputs (QueueDescriptor &descriptor, WorkloadInfo &info) const
 
template<typename QueueDescriptor >
void CollectQueueDescriptorOutputs (QueueDescriptor &descriptor, WorkloadInfo &info) const
 
template<typename QueueDescriptor >
WorkloadInfo PrepInfoAndDesc (QueueDescriptor &descriptor) const
 Helper function to reduce duplication in *LayerCreateWorkload. More...
 
template<typename LayerType , typename ... Params>
LayerTypeCloneBase (Graph &graph, Params &&... params) const
 
virtual ConstantTensors GetConstantTensorsByRef ()
 
- Protected Member Functions inherited from IConnectableLayer
 ~IConnectableLayer ()
 Objects are not deletable via the handle. More...
 
- Protected Attributes inherited from LayerWithParameters< PreCompiledDescriptor >
PreCompiledDescriptor m_Param
 The parameters for the layer (not including tensor-valued weights etc.). More...
 
- Protected Attributes inherited from Layer
std::vector< OutputHandlerm_OutputHandlers
 

Detailed Description

Definition at line 22 of file PreCompiledLayer.hpp.

Constructor & Destructor Documentation

◆ PreCompiledLayer()

PreCompiledLayer ( const PreCompiledDescriptor param,
const char *  name 
)

Definition at line 17 of file PreCompiledLayer.cpp.

References armnn::PreCompiled.

18  : LayerWithParameters(param.m_NumInputSlots, param.m_NumOutputSlots, LayerType::PreCompiled, param, name)
19 {}
LayerWithParameters(unsigned int numInputSlots, unsigned int numOutputSlots, LayerType type, const PreCompiledDescriptor &param, const char *name)

◆ ~PreCompiledLayer()

Definition at line 21 of file PreCompiledLayer.cpp.

22 {}

Member Function Documentation

◆ Accept()

void Accept ( ILayerVisitor visitor) const
overridevirtual

Apply a visitor to this layer.

Implements IConnectableLayer.

Definition at line 49 of file PreCompiledLayer.cpp.

References armnn::IgnoreUnused().

50 {
51  IgnoreUnused(visitor);
52  throw armnn::Exception("PreCompiledLayer should not appear in an input graph");
53 }
void IgnoreUnused(Ts &&...)
Base class for all ArmNN exceptions so that users can filter to just those.
Definition: Exceptions.hpp:46

◆ Clone()

PreCompiledLayer * Clone ( Graph graph) const
overridevirtual

Creates a dynamically-allocated copy of this layer.

Parameters
graph- The Graph into which this Layer is being cloned.

Implements Layer.

Definition at line 24 of file PreCompiledLayer.cpp.

References Layer::GetName(), and LayerWithParameters< PreCompiledDescriptor >::m_Param.

25 {
26  PreCompiledLayer* clone = CloneBase<PreCompiledLayer>(graph, m_Param, GetName());
27  clone->m_PreCompiledObject.reset(const_cast<PreCompiledLayer*>(this)->m_PreCompiledObject.release());
28  return clone;
29 }
PreCompiledLayer(const PreCompiledDescriptor &param, const char *name)
PreCompiledDescriptor m_Param
The parameters for the layer (not including tensor-valued weights etc.).
const char * GetName() const override
Returns the name of the layer.
Definition: Layer.hpp:305

◆ CreateWorkload()

std::unique_ptr< IWorkload > CreateWorkload ( const IWorkloadFactory factory) const
overridevirtual

Implements Layer.

Definition at line 31 of file PreCompiledLayer.cpp.

References IWorkloadFactory::CreatePreCompiled(), PreCompiledQueueDescriptor::m_PreCompiledObject, and LayerWithParameters< PreCompiledDescriptor >::PrepInfoAndDesc().

32 {
33  PreCompiledQueueDescriptor descriptor;
34  descriptor.m_PreCompiledObject = m_PreCompiledObject.get();
35  return factory.CreatePreCompiled(descriptor, PrepInfoAndDesc(descriptor));
36 }
WorkloadInfo PrepInfoAndDesc(QueueDescriptor &descriptor) const
Helper function to reduce duplication in *LayerCreateWorkload.

◆ SetPreCompiledObject()

void SetPreCompiledObject ( PreCompiledObjectPtr  preCompiledObject)

Definition at line 44 of file PreCompiledLayer.cpp.

45 {
46  m_PreCompiledObject = std::move(preCompiledObject);
47 }

◆ ValidateTensorShapesFromInputs()

void ValidateTensorShapesFromInputs ( )
overridevirtual

Implements Layer.

Definition at line 38 of file PreCompiledLayer.cpp.

39 {
40  // NOTE: since the PreCompiledLayer is an internal layer created from a valid SubgraphView,
41  // we do not need to validate its input shapes
42 }

The documentation for this class was generated from the following files: