ArmNN
 24.02
LayerSupportBase Class Reference

#include <LayerSupportBase.hpp>

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

Public Member Functions

bool IsLayerSupported (const LayerType &type, const std::vector< TensorInfo > &infos, const BaseDescriptor &descriptor, const Optional< LstmInputParamsInfo > &lstmParamsInfo=EmptyOptional(), const Optional< QuantizedLstmInputParamsInfo > &quantizedLstmParamsInfo=EmptyOptional(), Optional< std::string & > reasonIfUnsupported=EmptyOptional()) const override
 Default implementation of the ILayerSupport interface, Backends should implement this as a switch statement for each of their LayerTypes calling their specific backend implementation of IsXXXLayerSupported. More...
 
bool IsDetectionPostProcessSupported (const TensorInfo &boxEncodings, const TensorInfo &scores, const TensorInfo &anchors, const TensorInfo &detectionBoxes, const TensorInfo &detectionClasses, const TensorInfo &detectionScores, const TensorInfo &numDetections, const DetectionPostProcessDescriptor &descriptor, Optional< std::string & > reasonIfUnsupported=EmptyOptional()) const
 
bool IsMemCopySupported (const TensorInfo &input, const TensorInfo &output, Optional< std::string & > reasonIfUnsupported=EmptyOptional()) const
 
bool IsMemImportSupported (const TensorInfo &input, const TensorInfo &output, Optional< std::string & > reasonIfUnsupported=EmptyOptional()) const
 
bool IsMergeSupported (const TensorInfo &input0, const TensorInfo &input1, const TensorInfo &output, Optional< std::string & > reasonIfUnsupported=EmptyOptional()) const
 
bool IsQuantizedLstmSupported (const TensorInfo &input, const TensorInfo &previousCellStateIn, const TensorInfo &previousOutputIn, const TensorInfo &cellStateOut, const TensorInfo &output, const QuantizedLstmInputParamsInfo &paramsInfo, Optional< std::string & > reasonIfUnsupported=EmptyOptional()) const
 
bool IsShapeSupported (const TensorInfo &input, const TensorInfo &output, Optional< std::string & > reasonIfUnsupported=EmptyOptional()) const
 
bool IsStandInSupported (const std::vector< const TensorInfo * > &inputs, const std::vector< const TensorInfo * > &outputs, const StandInDescriptor &descriptor, Optional< std::string & > reasonIfUnsupported=EmptyOptional()) const
 

Additional Inherited Members

- Protected Member Functions inherited from ILayerSupport
 ILayerSupport ()
 
virtual ~ILayerSupport ()
 

Detailed Description

Definition at line 13 of file LayerSupportBase.hpp.

Member Function Documentation

◆ IsDetectionPostProcessSupported()

bool IsDetectionPostProcessSupported ( const TensorInfo boxEncodings,
const TensorInfo scores,
const TensorInfo anchors,
const TensorInfo detectionBoxes,
const TensorInfo detectionClasses,
const TensorInfo detectionScores,
const TensorInfo numDetections,
const DetectionPostProcessDescriptor descriptor,
Optional< std::string & >  reasonIfUnsupported = EmptyOptional() 
) const

Definition at line 85 of file LayerSupportBase.cpp.

94 {
95  return DefaultLayerSupport(__func__, __FILE__, __LINE__, reasonIfUnsupported);
96 }

Referenced by armnn::IsLayerTypeSupported().

◆ IsLayerSupported()

bool IsLayerSupported ( const LayerType type,
const std::vector< TensorInfo > &  infos,
const BaseDescriptor descriptor,
const Optional< LstmInputParamsInfo > &  lstmParamsInfo = EmptyOptional(),
const Optional< QuantizedLstmInputParamsInfo > &  quantizedLstmParamsInfo = EmptyOptional(),
Optional< std::string & >  reasonIfUnsupported = EmptyOptional() 
) const
overridevirtual

Default implementation of the ILayerSupport interface, Backends should implement this as a switch statement for each of their LayerTypes calling their specific backend implementation of IsXXXLayerSupported.

Reimplemented from ILayerSupport.

Reimplemented in NeonLayerSupport, ClLayerSupport, RefLayerSupport, and SampleDynamicLayerSupport.

Definition at line 40 of file LayerSupportBase.cpp.

46 {
47  switch(type)
48  {
49  case LayerType::MemCopy:
50  return IsMemCopySupported(infos[0], infos[1], reasonIfUnsupported);
52  return IsMemImportSupported(infos[0], infos[1], reasonIfUnsupported);
53  case LayerType::StandIn:
54  {
55  auto desc = *(PolymorphicDowncast<const StandInDescriptor*>(&descriptor));
56 
57  if (infos.size() != (desc.m_NumInputs + desc.m_NumOutputs))
58  {
59  throw InvalidArgumentException("Number of StandIn layer TensorInfos does not equal "
60  "the combined number of input and output slots assigned "
61  "to the StandIn descriptor");
62  }
63 
64  std::vector<const TensorInfo*> inputInfos;
65  for (uint32_t i = 0; i < desc.m_NumInputs; i++)
66  {
67  inputInfos.push_back(&infos[i]);
68  }
69  std::vector<const TensorInfo*> outputInfos;
70  for (uint32_t i = desc.m_NumInputs; i < infos.size(); i++)
71  {
72  outputInfos.push_back(&infos[i]);
73  }
74 
75  return IsStandInSupported(inputInfos,
76  outputInfos,
77  desc,
78  reasonIfUnsupported);
79  }
80  default:
81  return DefaultLayerSupport(__func__, __FILE__, __LINE__, reasonIfUnsupported);
82  }
83 }

References LayerSupportBase::IsMemCopySupported(), LayerSupportBase::IsMemImportSupported(), LayerSupportBase::IsStandInSupported(), armnn::MemCopy, armnn::MemImport, and armnn::StandIn.

◆ IsMemCopySupported()

bool IsMemCopySupported ( const TensorInfo input,
const TensorInfo output,
Optional< std::string & >  reasonIfUnsupported = EmptyOptional() 
) const

Definition at line 98 of file LayerSupportBase.cpp.

101 {
102  return true;
103 }

Referenced by LayerSupportBase::IsLayerSupported(), ClLayerSupport::IsLayerSupported(), and armnn::IsLayerTypeSupported().

◆ IsMemImportSupported()

bool IsMemImportSupported ( const TensorInfo input,
const TensorInfo output,
Optional< std::string & >  reasonIfUnsupported = EmptyOptional() 
) const

◆ IsMergeSupported()

bool IsMergeSupported ( const TensorInfo input0,
const TensorInfo input1,
const TensorInfo output,
Optional< std::string & >  reasonIfUnsupported = EmptyOptional() 
) const

Definition at line 112 of file LayerSupportBase.cpp.

116 {
117  return DefaultLayerSupport(__func__, __FILE__, __LINE__, reasonIfUnsupported);
118 }

Referenced by RefLayerSupport::IsLayerSupported(), ClLayerSupport::IsLayerSupported(), and armnn::IsLayerTypeSupported().

◆ IsQuantizedLstmSupported()

bool IsQuantizedLstmSupported ( const TensorInfo input,
const TensorInfo previousCellStateIn,
const TensorInfo previousOutputIn,
const TensorInfo cellStateOut,
const TensorInfo output,
const QuantizedLstmInputParamsInfo paramsInfo,
Optional< std::string & >  reasonIfUnsupported = EmptyOptional() 
) const

Definition at line 120 of file LayerSupportBase.cpp.

127 {
128  return DefaultLayerSupport(__func__, __FILE__, __LINE__, reasonIfUnsupported);
129 }

Referenced by RefLayerSupport::IsLayerSupported().

◆ IsShapeSupported()

bool IsShapeSupported ( const TensorInfo input,
const TensorInfo output,
Optional< std::string & >  reasonIfUnsupported = EmptyOptional() 
) const

Definition at line 131 of file LayerSupportBase.cpp.

134 {
135  return DefaultLayerSupport(__func__, __FILE__, __LINE__, reasonIfUnsupported);
136 }

Referenced by ClLayerSupport::IsLayerSupported(), and armnn::IsLayerTypeSupported().

◆ IsStandInSupported()

bool IsStandInSupported ( const std::vector< const TensorInfo * > &  inputs,
const std::vector< const TensorInfo * > &  outputs,
const StandInDescriptor descriptor,
Optional< std::string & >  reasonIfUnsupported = EmptyOptional() 
) const

Definition at line 138 of file LayerSupportBase.cpp.

142 {
143  if (reasonIfUnsupported)
144  {
145  std::stringstream message;
146  message << "StandIn layer is not executable via backends";
147 
148  reasonIfUnsupported.value() = message.str();
149  }
150 
151  return false;
152 }

References OptionalReferenceSwitch< std::is_reference< T >::value, T >::value().

Referenced by LayerSupportBase::IsLayerSupported().


The documentation for this class was generated from the following files:
armnn::LayerSupportBase::IsStandInSupported
bool IsStandInSupported(const std::vector< const TensorInfo * > &inputs, const std::vector< const TensorInfo * > &outputs, const StandInDescriptor &descriptor, Optional< std::string & > reasonIfUnsupported=EmptyOptional()) const
Definition: LayerSupportBase.cpp:138
armnn::LayerType::StandIn
@ StandIn
armnn::LayerSupportBase::IsMemImportSupported
bool IsMemImportSupported(const TensorInfo &input, const TensorInfo &output, Optional< std::string & > reasonIfUnsupported=EmptyOptional()) const
Definition: LayerSupportBase.cpp:105
armnn::LayerType::MemImport
@ MemImport
armnn::LayerType::MemCopy
@ MemCopy
armnn::LayerSupportBase::IsMemCopySupported
bool IsMemCopySupported(const TensorInfo &input, const TensorInfo &output, Optional< std::string & > reasonIfUnsupported=EmptyOptional()) const
Definition: LayerSupportBase.cpp:98