ArmNN
 23.05
Layer Class Referenceabstract

#include <Layer.hpp>

Inheritance diagram for Layer:
IConnectableLayer AbsLayer BindableLayer CastLayer ConstantLayer ConvertFp16ToFp32Layer ConvertFp32ToFp16Layer DebugLayer DequantizeLayer ElementwiseBaseLayer FloorLayer GatherNdLayer LayerWithParameters< Parameters > MapLayer MemCopyLayer MemImportLayer MergeLayer PreluLayer QuantizedLstmLayer QuantizeLayer RankLayer RsqrtLayer ShapeLayer SwitchLayer UnmapLayer LayerWithParameters< ActivationDescriptor > LayerWithParameters< ArgMinMaxDescriptor > LayerWithParameters< BatchMatMulDescriptor > LayerWithParameters< BatchNormalizationDescriptor > LayerWithParameters< BatchToSpaceNdDescriptor > LayerWithParameters< ChannelShuffleDescriptor > LayerWithParameters< ComparisonDescriptor > LayerWithParameters< Convolution2dDescriptor > LayerWithParameters< Convolution3dDescriptor > LayerWithParameters< DepthToSpaceDescriptor > LayerWithParameters< DepthwiseConvolution2dDescriptor > LayerWithParameters< DetectionPostProcessDescriptor > LayerWithParameters< ElementwiseBinaryDescriptor > LayerWithParameters< ElementwiseUnaryDescriptor > LayerWithParameters< FakeQuantizationDescriptor > LayerWithParameters< FillDescriptor > LayerWithParameters< FullyConnectedDescriptor > LayerWithParameters< GatherDescriptor > LayerWithParameters< InstanceNormalizationDescriptor > LayerWithParameters< L2NormalizationDescriptor > LayerWithParameters< LogicalBinaryDescriptor > LayerWithParameters< LogSoftmaxDescriptor > LayerWithParameters< LstmDescriptor > LayerWithParameters< MeanDescriptor > LayerWithParameters< NormalizationDescriptor > LayerWithParameters< OriginsDescriptor > LayerWithParameters< PadDescriptor > LayerWithParameters< PermuteDescriptor > LayerWithParameters< Pooling2dDescriptor > LayerWithParameters< Pooling3dDescriptor > LayerWithParameters< PreCompiledDescriptor > LayerWithParameters< QLstmDescriptor > LayerWithParameters< ReduceDescriptor > LayerWithParameters< ReshapeDescriptor > LayerWithParameters< ResizeDescriptor > LayerWithParameters< SliceDescriptor > LayerWithParameters< SoftmaxDescriptor > LayerWithParameters< SpaceToBatchNdDescriptor > LayerWithParameters< SpaceToDepthDescriptor > LayerWithParameters< StackDescriptor > LayerWithParameters< StandInDescriptor > LayerWithParameters< StridedSliceDescriptor > LayerWithParameters< TransposeConvolution2dDescriptor > LayerWithParameters< TransposeDescriptor > LayerWithParameters< ViewsDescriptor >

Public Member Functions

 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)
 
void ExecuteStrategy (IStrategy &strategy) const override
 Apply a visitor to this layer. More...
 
const std::string & GetNameStr () const
 
const OutputHandlerGetOutputHandler (unsigned int i=0) const
 
OutputHandlerGetOutputHandler (unsigned int i=0)
 
ShapeInferenceMethod GetShapeInferenceMethod () const
 
bool GetAllowExpandedDims () const
 
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 override
 Returns the armnn::LayerType of this layer. More...
 
DataType GetDataType () const
 
const BackendIdGetBackendId () const
 
void SetBackendId (const BackendId &id) override
 Set the backend of the IConnectableLayer. More...
 
virtual std::unique_ptr< IWorkloadCreateWorkload (const IWorkloadFactory &factory) const =0
 
virtual void CreateTensorHandles (const TensorHandleFactoryRegistry &registry, const IWorkloadFactory &factory, const bool IsMemoryManaged=true)
 
virtual LayerClone (Graph &graph) const =0
 Creates a dynamically-allocated copy of this layer. More...
 
void VerifyLayerConnections (unsigned int expectedConnections, const CheckLocation &location) const
 
virtual void ValidateTensorShapesFromInputs ()=0
 
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 SerializeLayerParameters (ParameterStringifyFunction &fn) const
 Helper to serialize the layer parameters to string. 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
 
void SetShapeInferenceMethod (ShapeInferenceMethod shapeInferenceMethod)
 
void SetAllowExpandedDims (bool allowExpandedDims)
 
template<typename T >
std::shared_ptr< T > GetAdditionalInformation () const
 
void SetAdditionalInfoForObject (const AdditionalInfoObjectPtr &additionalInfo)
 
virtual const BaseDescriptorGetParameters () const override
 If the layer has a descriptor return it. More...
 

Protected Member Functions

virtual ~Layer ()=default
 
template<typename QueueDescriptor >
void CollectQueueDescriptorInputs (QueueDescriptor &descriptor, WorkloadInfo &info) const
 
template<typename QueueDescriptor >
void CollectQueueDescriptorOutputs (QueueDescriptor &descriptor, WorkloadInfo &info) const
 
void ValidateAndCopyShape (const TensorShape &outputShape, const TensorShape &inferredShape, const ShapeInferenceMethod shapeInferenceMethod, const std::string &layerName, const unsigned int outputSlotIndex=0)
 
void VerifyShapeInferenceType (const TensorShape &outputShape, ShapeInferenceMethod shapeInferenceMethod)
 
template<typename QueueDescriptor >
WorkloadInfo PrepInfoAndDesc (QueueDescriptor &descriptor) const
 Helper function to reduce duplication in *Layer::CreateWorkload. More...
 
template<typename LayerType , typename ... Params>
LayerTypeCloneBase (Graph &graph, Params &&... params) const
 
virtual ConstantTensors GetConstantTensorsByRef () override final
 
virtual ImmutableConstantTensors GetConstantTensorsByRef () const override
 
void SetAdditionalInfo (QueueDescriptor &descriptor) const
 
- Protected Member Functions inherited from IConnectableLayer
 ~IConnectableLayer ()
 Objects are not deletable via the handle. More...
 

Protected Attributes

AdditionalInfoObjectPtr m_AdditionalInfoObject
 
std::vector< OutputHandlerm_OutputHandlers
 
ShapeInferenceMethod m_ShapeInferenceMethod
 

Friends

class Graph
 

Additional Inherited Members

- Public Types inherited from IConnectableLayer
using ConstantTensors = std::vector< std::reference_wrapper< std::shared_ptr< ConstTensorHandle > >>
 
using ImmutableConstantTensors = std::vector< std::reference_wrapper< const std::shared_ptr< ConstTensorHandle > >>
 

Detailed Description

Definition at line 217 of file Layer.hpp.

Constructor & Destructor Documentation

◆ Layer() [1/2]

Layer ( unsigned int  numInputSlots,
unsigned int  numOutputSlots,
LayerType  type,
const char *  name 
)
Parameters
name- Optional name for the layer (may be nullptr).

Definition at line 247 of file Layer.cpp.

251 : Layer(numInputSlots, numOutputSlots, type, DataLayout::NCHW, name)
252 {
253 }

References armnn::NCHW.

◆ Layer() [2/2]

Layer ( unsigned int  numInputSlots,
unsigned int  numOutputSlots,
LayerType  type,
DataLayout  layout,
const char *  name 
)

Definition at line 220 of file Layer.cpp.

225 : m_OutputHandlers(numOutputSlots)
227 , m_LayerName(name ? name : "")
228 , m_Type(type)
229 , m_BackendId()
230 , m_BackendHint(EmptyOptional())
231 , m_Guid(arm::pipe::IProfilingService::GetNextGuid())
232 {
233  IgnoreUnused(layout);
234  m_InputSlots.reserve(numInputSlots);
235  for (unsigned int i = 0; i < numInputSlots; ++i)
236  {
237  m_InputSlots.emplace_back(*this, i);
238  }
239 
240  m_OutputSlots.reserve(numOutputSlots);
241  for (unsigned int i = 0; i < numOutputSlots; ++i)
242  {
243  m_OutputSlots.emplace_back(*this, m_OutputHandlers[i]);
244  }
245 }

References armnn::IgnoreUnused(), Layer::m_OutputHandlers, and armnn::ValidateOnly.

◆ ~Layer()

virtual ~Layer ( )
protectedvirtualdefault

Member Function Documentation

◆ AddRelatedLayerName()

void AddRelatedLayerName ( const std::string  layerName)
inline

Definition at line 332 of file Layer.hpp.

332 { m_RelatedLayerNames.emplace_back(layerName); }

◆ BackendSelectionHint()

void BackendSelectionHint ( Optional< BackendId backend)
inlinefinalvirtual

Provide a hint for the optimizer as to which backend to prefer for this layer.

By providing a BackendSelectionHint there is no guarantee the input backend supports that layer. If IsLayerSupported() returns false with the backend hint, we default to calling IsLayerSupported() on the BackendPreferences vector. Use SetBackendId() if we can guarantee a backend supports that layer (IsLayerSupported returns true for a specific backend).

Implements IConnectableLayer.

Definition at line 338 of file Layer.hpp.

339  {
340  m_BackendHint = backend;
341  }

◆ BeginInputSlots()

std::vector<InputSlot>::iterator BeginInputSlots ( )
inline

◆ BeginOutputSlots()

◆ Clone()

virtual Layer* Clone ( Graph graph) const
pure virtual

◆ CloneBase()

LayerType * CloneBase ( Graph graph,
Params &&...  params 
) const
protected

Definition at line 14 of file LayerCloneBase.hpp.

15 {
16  LayerType* const layer = graph.AddLayer<LayerType>(std::forward<Params>(params)...);
17 
18  layer->BackendSelectionHint(GetBackendHint());
19  layer->SetBackendId(GetBackendId());
20  layer->SetGuid(GetGuid());
21  layer->SetShapeInferenceMethod(m_ShapeInferenceMethod);
22  layer->SetAllowExpandedDims(m_AllowExpandedDims);
23 
24  return layer;
25 }

References Graph::AddLayer(), Layer::GetBackendHint(), Layer::GetBackendId(), Layer::GetGuid(), and Layer::m_ShapeInferenceMethod.

◆ CollectQueueDescriptorInputs()

void CollectQueueDescriptorInputs ( QueueDescriptor descriptor,
WorkloadInfo info 
) const
inlineprotected

Definition at line 373 of file Layer.hpp.

374  {
375  WorkloadDataCollector dataCollector(descriptor.m_Inputs, info.m_InputTensorInfos);
376  CollectWorkloadInputs(dataCollector);
377  }

References armnn::info, and QueueDescriptor::m_Inputs.

Referenced by Layer::PrepInfoAndDesc().

◆ CollectQueueDescriptorOutputs()

void CollectQueueDescriptorOutputs ( QueueDescriptor descriptor,
WorkloadInfo info 
) const
inlineprotected

Definition at line 380 of file Layer.hpp.

381  {
382  WorkloadDataCollector dataCollector(descriptor.m_Outputs, info.m_OutputTensorInfos);
383  CollectWorkloadOutputs(dataCollector);
384  }

References armnn::info, and QueueDescriptor::m_Outputs.

Referenced by Layer::PrepInfoAndDesc().

◆ CreateTensorHandles()

void CreateTensorHandles ( const TensorHandleFactoryRegistry registry,
const IWorkloadFactory factory,
const bool  IsMemoryManaged = true 
)
virtual

Reimplemented in ConcatLayer, OutputLayer, and SplitterLayer.

Definition at line 279 of file Layer.cpp.

282 {
283  for (unsigned int idx=0; idx < GetNumOutputSlots(); idx++)
284  {
285 
286  OutputSlot& slot = GetOutputSlot(idx);
287  ITensorHandleFactory::FactoryId factoryId = slot.GetTensorHandleFactoryId();
288 
289  OutputHandler& handler = GetOutputHandler(idx);
290  if (factoryId == ITensorHandleFactory::LegacyFactoryId)
291  {
292  handler.CreateTensorHandles(workloadFactory, IsMemoryManaged);
293  }
294  else
295  {
296  ITensorHandleFactory* handleFactory;
297  handleFactory = registry.GetFactory(factoryId);
298  ARMNN_ASSERT(handleFactory);
299  handler.CreateTensorHandles(*handleFactory, IsMemoryManaged);
300  }
301  }
302 }

References ARMNN_ASSERT, OutputHandler::CreateTensorHandles(), TensorHandleFactoryRegistry::GetFactory(), Layer::GetNumOutputSlots(), Layer::GetOutputHandler(), Layer::GetOutputSlot(), OutputSlot::GetTensorHandleFactoryId(), and ITensorHandleFactory::LegacyFactoryId.

◆ CreateWorkload()

◆ EndInputSlots()

std::vector<InputSlot>::iterator EndInputSlots ( )
inline

◆ EndOutputSlots()

◆ ExecuteStrategy()

void ExecuteStrategy ( IStrategy strategy) const
overridevirtual

Apply a visitor to this layer.

Implements IConnectableLayer.

Reimplemented in BindableLayer, QLstmLayer, QuantizedLstmLayer, PermuteLayer, TransposeLayer, LayerWithParameters< Parameters >, LayerWithParameters< SoftmaxDescriptor >, LayerWithParameters< FakeQuantizationDescriptor >, LayerWithParameters< ReduceDescriptor >, LayerWithParameters< LstmDescriptor >, LayerWithParameters< ChannelShuffleDescriptor >, LayerWithParameters< PreCompiledDescriptor >, LayerWithParameters< LogSoftmaxDescriptor >, LayerWithParameters< SpaceToBatchNdDescriptor >, LayerWithParameters< BatchToSpaceNdDescriptor >, LayerWithParameters< PermuteDescriptor >, LayerWithParameters< GatherDescriptor >, LayerWithParameters< ElementwiseUnaryDescriptor >, LayerWithParameters< DepthToSpaceDescriptor >, LayerWithParameters< SpaceToDepthDescriptor >, LayerWithParameters< OriginsDescriptor >, LayerWithParameters< ReshapeDescriptor >, LayerWithParameters< ViewsDescriptor >, LayerWithParameters< Pooling2dDescriptor >, LayerWithParameters< StandInDescriptor >, LayerWithParameters< Convolution2dDescriptor >, LayerWithParameters< ActivationDescriptor >, LayerWithParameters< MeanDescriptor >, LayerWithParameters< StackDescriptor >, LayerWithParameters< TransposeDescriptor >, LayerWithParameters< InstanceNormalizationDescriptor >, LayerWithParameters< ComparisonDescriptor >, LayerWithParameters< TransposeConvolution2dDescriptor >, LayerWithParameters< BatchNormalizationDescriptor >, LayerWithParameters< BatchMatMulDescriptor >, LayerWithParameters< ArgMinMaxDescriptor >, LayerWithParameters< LogicalBinaryDescriptor >, LayerWithParameters< DetectionPostProcessDescriptor >, LayerWithParameters< PadDescriptor >, LayerWithParameters< L2NormalizationDescriptor >, LayerWithParameters< Convolution3dDescriptor >, LayerWithParameters< SliceDescriptor >, LayerWithParameters< QLstmDescriptor >, LayerWithParameters< FillDescriptor >, LayerWithParameters< DepthwiseConvolution2dDescriptor >, LayerWithParameters< NormalizationDescriptor >, LayerWithParameters< FullyConnectedDescriptor >, LayerWithParameters< ResizeDescriptor >, LayerWithParameters< Pooling3dDescriptor >, LayerWithParameters< ElementwiseBinaryDescriptor >, LayerWithParameters< StridedSliceDescriptor >, ReshapeLayer, UnidirectionalSequenceLstmLayer, ConcatLayer, LstmLayer, SplitterLayer, TransposeConvolution2dLayer, DetectionPostProcessLayer, OutputLayer, BatchNormalizationLayer, ConstantLayer, Convolution2dLayer, Convolution3dLayer, DepthwiseConvolution2dLayer, FullyConnectedLayer, ComparisonLayer, DepthToSpaceLayer, LogicalBinaryLayer, MeanLayer, PadLayer, PreluLayer, SpaceToBatchNdLayer, SpaceToDepthLayer, StandInLayer, ArgMinMaxLayer, BatchToSpaceNdLayer, ElementwiseUnaryLayer, GatherLayer, Pooling2dLayer, Pooling3dLayer, ReduceLayer, ResizeLayer, ShapeLayer, SliceLayer, StackLayer, StridedSliceLayer, ElementwiseBinaryLayer, MergeLayer, PreCompiledLayer, RankLayer, FakeQuantizationLayer, LogSoftmaxLayer, AbsLayer, ConvertFp16ToFp32Layer, DebugLayer, DequantizeLayer, FloorLayer, InputLayer, InstanceNormalizationLayer, L2NormalizationLayer, MapLayer, MemCopyLayer, MemImportLayer, NormalizationLayer, RsqrtLayer, SoftmaxLayer, SwitchLayer, UnmapLayer, ConvertFp32ToFp16Layer, ElementwiseBaseLayer, FillLayer, ActivationLayer, DivisionLayer, MaximumLayer, MinimumLayer, MultiplicationLayer, SubtractionLayer, AdditionLayer, and QuantizeLayer.

Definition at line 536 of file Layer.cpp.

537 {
538  strategy.ExecuteStrategy(this, BaseDescriptor(), {}, GetName());
539 }

References IStrategy::ExecuteStrategy(), and Layer::GetName().

◆ GetAdditionalInformation()

std::shared_ptr<T> GetAdditionalInformation ( ) const
inline

Definition at line 355 of file Layer.hpp.

356  {
357  return std::static_pointer_cast<T>(m_AdditionalInfoObject);
358  }

References Layer::m_AdditionalInfoObject.

Referenced by NeonBackend::OptimizeSubgraphView(), and ClBackend::OptimizeSubgraphView().

◆ GetAllowExpandedDims()

bool GetAllowExpandedDims ( ) const
inline

Definition at line 243 of file Layer.hpp.

243 { return m_AllowExpandedDims; };

Referenced by LayerWithParameters< StridedSliceDescriptor >::PrepInfoAndDesc().

◆ GetBackendHint()

Optional<BackendId> GetBackendHint ( ) const
inline

Definition at line 342 of file Layer.hpp.

342 { return m_BackendHint; }

Referenced by NetworkImpl::AddPrecompiledLayer(), and Layer::CloneBase().

◆ GetBackendId()

◆ GetConstantTensorsByRef() [1/2]

◆ GetConstantTensorsByRef() [2/2]

Layer::ConstantTensors GetConstantTensorsByRef ( )
finaloverrideprotectedvirtual

Implements IConnectableLayer.

Definition at line 541 of file Layer.cpp.

542 {
543  const Layer *constThis = const_cast<const Layer*>(this);
544  ConstantTensors res;
545 
546  ImmutableConstantTensors immutableData = constThis->GetConstantTensorsByRef();
547  for (auto i : immutableData)
548  {
549  res.push_back(const_cast<std::shared_ptr<ConstTensorHandle>&>(i.get()));
550  }
551  return res;
552 }

References Layer::GetConstantTensorsByRef().

Referenced by Layer::GetConstantTensorsByRef(), and Layer::OperateOnConstantTensors().

◆ GetDataType()

◆ GetGuid()

◆ GetInputSlot() [1/2]

const InputSlot& GetInputSlot ( unsigned int  index) const
inlineoverridevirtual

Get a const input slot handle by slot index.

Implements IConnectableLayer.

Examples
AsyncExecutionSample.cpp, and SimpleSample.cpp.

Definition at line 324 of file Layer.hpp.

324 { return m_InputSlots.at(index); }

Referenced by Graph::AddCompatibilityLayers(), armnn::ChainReduceLayers(), ConvertAvgPool2DIgnoreValueToTosaOperator(), ConvertConcatToTosaOperator(), ConvertConv2dToTosaOperator(), ConvertElementwiseBinaryToTosaOperator(), ConvertElementwiseUnaryOperator(), ConvertPooling2DToTosaOperator(), ConvertReshapeToTosaOperator(), ConvertSliceToTosaOperator(), ConvertTransposeConv2dToTosaOperator(), ConvertTransposeToTosaOperator(), DebugLayer::CreateWorkload(), armnn::optimizations::pad_fold::FoldPadIntoLayer2dImpl(), LayerWithParameters< StridedSliceDescriptor >::GetConnectedConstantAsInputTensors(), Layer::GetDataType(), armnn::GetLayerInOutDatatype(), Graph::Graph(), InputSlot::Insert(), armnn::InsertConvertFp16ToFp32LayersBefore(), armnn::InsertConvertFp32ToFp16LayersAfter(), armnn::InsertDebugLayerAfter(), RefBackend::OptimizeSubgraphView(), NeonBackend::OptimizeSubgraphView(), ClBackend::OptimizeSubgraphView(), PermuteAsReshapeImpl::Run(), TransposeAsReshapeImpl::Run(), OptimizeConsecutiveReshapesImpl::Run(), OptimizeInverseConversionsImpl::Run(), PermuteAndBatchToSpaceAsDepthToSpaceImpl< PermuteType >::Run(), MovePermuteUpImpl::Run(), MoveTransposeUpImpl::Run(), OptimizeInversePermutesImpl< PermuteType >::Run(), AddBroadcastReshapeLayerImpl::Run(), FuseBatchNorm< ConvLayer, ArmnnType, T >::Run(), Convolution2dLayer::SerializeLayerParameters(), Convolution3dLayer::SerializeLayerParameters(), DepthwiseConvolution2dLayer::SerializeLayerParameters(), ElementwiseBaseLayer::ValidateTensorShapesFromInputs(), QuantizeLayer::ValidateTensorShapesFromInputs(), ChannelShuffleLayer::ValidateTensorShapesFromInputs(), ActivationLayer::ValidateTensorShapesFromInputs(), ConvertFp32ToFp16Layer::ValidateTensorShapesFromInputs(), FillLayer::ValidateTensorShapesFromInputs(), SoftmaxLayer::ValidateTensorShapesFromInputs(), FakeQuantizationLayer::ValidateTensorShapesFromInputs(), ConvertFp16ToFp32Layer::ValidateTensorShapesFromInputs(), FloorLayer::ValidateTensorShapesFromInputs(), TransposeLayer::ValidateTensorShapesFromInputs(), Pooling3dLayer::ValidateTensorShapesFromInputs(), SwitchLayer::ValidateTensorShapesFromInputs(), PermuteLayer::ValidateTensorShapesFromInputs(), MemCopyLayer::ValidateTensorShapesFromInputs(), InstanceNormalizationLayer::ValidateTensorShapesFromInputs(), L2NormalizationLayer::ValidateTensorShapesFromInputs(), StackLayer::ValidateTensorShapesFromInputs(), BatchToSpaceNdLayer::ValidateTensorShapesFromInputs(), MemImportLayer::ValidateTensorShapesFromInputs(), MergeLayer::ValidateTensorShapesFromInputs(), SliceLayer::ValidateTensorShapesFromInputs(), NormalizationLayer::ValidateTensorShapesFromInputs(), DebugLayer::ValidateTensorShapesFromInputs(), CastLayer::ValidateTensorShapesFromInputs(), AbsLayer::ValidateTensorShapesFromInputs(), Pooling2dLayer::ValidateTensorShapesFromInputs(), DequantizeLayer::ValidateTensorShapesFromInputs(), ResizeLayer::ValidateTensorShapesFromInputs(), RsqrtLayer::ValidateTensorShapesFromInputs(), ShapeLayer::ValidateTensorShapesFromInputs(), PadLayer::ValidateTensorShapesFromInputs(), LogSoftmaxLayer::ValidateTensorShapesFromInputs(), MeanLayer::ValidateTensorShapesFromInputs(), ReshapeLayer::ValidateTensorShapesFromInputs(), DepthwiseConvolution2dLayer::ValidateTensorShapesFromInputs(), Convolution2dLayer::ValidateTensorShapesFromInputs(), FullyConnectedLayer::ValidateTensorShapesFromInputs(), Convolution3dLayer::ValidateTensorShapesFromInputs(), GatherNdLayer::ValidateTensorShapesFromInputs(), BatchMatMulLayer::ValidateTensorShapesFromInputs(), ElementwiseBinaryLayer::ValidateTensorShapesFromInputs(), StridedSliceLayer::ValidateTensorShapesFromInputs(), DetectionPostProcessLayer::ValidateTensorShapesFromInputs(), GatherLayer::ValidateTensorShapesFromInputs(), ArgMinMaxLayer::ValidateTensorShapesFromInputs(), ElementwiseUnaryLayer::ValidateTensorShapesFromInputs(), ReduceLayer::ValidateTensorShapesFromInputs(), SpaceToBatchNdLayer::ValidateTensorShapesFromInputs(), SpaceToDepthLayer::ValidateTensorShapesFromInputs(), TransposeConvolution2dLayer::ValidateTensorShapesFromInputs(), LogicalBinaryLayer::ValidateTensorShapesFromInputs(), ComparisonLayer::ValidateTensorShapesFromInputs(), DepthToSpaceLayer::ValidateTensorShapesFromInputs(), PreluLayer::ValidateTensorShapesFromInputs(), LstmLayer::ValidateTensorShapesFromInputs(), ConcatLayer::ValidateTensorShapesFromInputs(), UnidirectionalSequenceLstmLayer::ValidateTensorShapesFromInputs(), BatchNormalizationLayer::ValidateTensorShapesFromInputs(), OutputLayer::ValidateTensorShapesFromInputs(), QuantizedLstmLayer::ValidateTensorShapesFromInputs(), QLstmLayer::ValidateTensorShapesFromInputs(), and Layer::VerifyLayerConnections().

◆ GetInputSlot() [2/2]

InputSlot& GetInputSlot ( unsigned int  index)
inlineoverridevirtual

Get the input slot handle by slot index.

Implements IConnectableLayer.

Definition at line 325 of file Layer.hpp.

325 { return m_InputSlots.at(index); }

◆ GetInputSlots()

◆ GetName()

const char* GetName ( ) const
inlineoverridevirtual

Returns the name of the layer.

Implements IConnectableLayer.

Definition at line 319 of file Layer.hpp.

319 { return m_LayerName.c_str(); }

Referenced by Graph::AddCompatibilityLayers(), ChannelShuffleLayer::Clone(), QuantizeLayer::Clone(), ActivationLayer::Clone(), ConvertFp32ToFp16Layer::Clone(), FillLayer::Clone(), RankLayer::Clone(), CastLayer::Clone(), DebugLayer::Clone(), StackLayer::Clone(), StridedSliceLayer::Clone(), SwitchLayer::Clone(), DequantizeLayer::Clone(), MapLayer::Clone(), UnmapLayer::Clone(), MemCopyLayer::Clone(), MemImportLayer::Clone(), AbsLayer::Clone(), MergeLayer::Clone(), NormalizationLayer::Clone(), BatchMatMulLayer::Clone(), Pooling2dLayer::Clone(), AdditionLayer::Clone(), Pooling3dLayer::Clone(), FakeQuantizationLayer::Clone(), ConvertFp16ToFp32Layer::Clone(), FloorLayer::Clone(), BatchToSpaceNdLayer::Clone(), GatherNdLayer::Clone(), ResizeLayer::Clone(), InputLayer::Clone(), RsqrtLayer::Clone(), ShapeLayer::Clone(), InstanceNormalizationLayer::Clone(), SliceLayer::Clone(), SoftmaxLayer::Clone(), L2NormalizationLayer::Clone(), StandInLayer::Clone(), LogicalBinaryLayer::Clone(), ArgMinMaxLayer::Clone(), LogSoftmaxLayer::Clone(), SubtractionLayer::Clone(), DepthToSpaceLayer::Clone(), TransposeLayer::Clone(), MaximumLayer::Clone(), MeanLayer::Clone(), ComparisonLayer::Clone(), DivisionLayer::Clone(), MinimumLayer::Clone(), MultiplicationLayer::Clone(), ElementwiseBinaryLayer::Clone(), PadLayer::Clone(), PermuteLayer::Clone(), ElementwiseUnaryLayer::Clone(), PreluLayer::Clone(), ReduceLayer::Clone(), GatherLayer::Clone(), SpaceToBatchNdLayer::Clone(), SpaceToDepthLayer::Clone(), ConstantLayer::Clone(), ReshapeLayer::Clone(), DepthwiseConvolution2dLayer::Clone(), FullyConnectedLayer::Clone(), Convolution2dLayer::Clone(), Convolution3dLayer::Clone(), DetectionPostProcessLayer::Clone(), PreCompiledLayer::Clone(), TransposeConvolution2dLayer::Clone(), SplitterLayer::Clone(), LstmLayer::Clone(), UnidirectionalSequenceLstmLayer::Clone(), ConcatLayer::Clone(), BatchNormalizationLayer::Clone(), OutputLayer::Clone(), QuantizedLstmLayer::Clone(), QLstmLayer::Clone(), QuantizeLayer::ExecuteStrategy(), AdditionLayer::ExecuteStrategy(), SubtractionLayer::ExecuteStrategy(), MaximumLayer::ExecuteStrategy(), MinimumLayer::ExecuteStrategy(), MultiplicationLayer::ExecuteStrategy(), DivisionLayer::ExecuteStrategy(), ActivationLayer::ExecuteStrategy(), ElementwiseBaseLayer::ExecuteStrategy(), FillLayer::ExecuteStrategy(), ConvertFp32ToFp16Layer::ExecuteStrategy(), L2NormalizationLayer::ExecuteStrategy(), DebugLayer::ExecuteStrategy(), MemCopyLayer::ExecuteStrategy(), DequantizeLayer::ExecuteStrategy(), SoftmaxLayer::ExecuteStrategy(), NormalizationLayer::ExecuteStrategy(), FloorLayer::ExecuteStrategy(), SwitchLayer::ExecuteStrategy(), ConvertFp16ToFp32Layer::ExecuteStrategy(), RsqrtLayer::ExecuteStrategy(), InstanceNormalizationLayer::ExecuteStrategy(), InputLayer::ExecuteStrategy(), LogSoftmaxLayer::ExecuteStrategy(), MergeLayer::ExecuteStrategy(), ElementwiseBinaryLayer::ExecuteStrategy(), PreCompiledLayer::ExecuteStrategy(), RankLayer::ExecuteStrategy(), ArgMinMaxLayer::ExecuteStrategy(), StackLayer::ExecuteStrategy(), StridedSliceLayer::ExecuteStrategy(), BatchToSpaceNdLayer::ExecuteStrategy(), SliceLayer::ExecuteStrategy(), ResizeLayer::ExecuteStrategy(), Pooling2dLayer::ExecuteStrategy(), Pooling3dLayer::ExecuteStrategy(), ElementwiseUnaryLayer::ExecuteStrategy(), ReduceLayer::ExecuteStrategy(), GatherLayer::ExecuteStrategy(), ShapeLayer::ExecuteStrategy(), PadLayer::ExecuteStrategy(), MeanLayer::ExecuteStrategy(), ComparisonLayer::ExecuteStrategy(), DepthToSpaceLayer::ExecuteStrategy(), StandInLayer::ExecuteStrategy(), SpaceToDepthLayer::ExecuteStrategy(), PreluLayer::ExecuteStrategy(), LogicalBinaryLayer::ExecuteStrategy(), SpaceToBatchNdLayer::ExecuteStrategy(), FullyConnectedLayer::ExecuteStrategy(), DepthwiseConvolution2dLayer::ExecuteStrategy(), Convolution2dLayer::ExecuteStrategy(), Convolution3dLayer::ExecuteStrategy(), BatchNormalizationLayer::ExecuteStrategy(), ConstantLayer::ExecuteStrategy(), OutputLayer::ExecuteStrategy(), DetectionPostProcessLayer::ExecuteStrategy(), TransposeConvolution2dLayer::ExecuteStrategy(), SplitterLayer::ExecuteStrategy(), LstmLayer::ExecuteStrategy(), ConcatLayer::ExecuteStrategy(), ReshapeLayer::ExecuteStrategy(), UnidirectionalSequenceLstmLayer::ExecuteStrategy(), LayerWithParameters< StridedSliceDescriptor >::ExecuteStrategy(), TransposeLayer::ExecuteStrategy(), PermuteLayer::ExecuteStrategy(), QuantizedLstmLayer::ExecuteStrategy(), QLstmLayer::ExecuteStrategy(), Layer::ExecuteStrategy(), BindableLayer::ExecuteStrategy(), armnn::optimizations::pad_fold::FoldPadIntoLayer2dImpl(), armnn::InsertConvertFp16ToFp32LayersBefore(), armnn::InsertConvertFp32ToFp16LayersAfter(), armnn::IsLayerOptimizable(), NeonBackend::OptimizeSubgraphView(), ClBackend::OptimizeSubgraphView(), PermuteAsReshapeImpl::Run(), TransposeAsReshapeImpl::Run(), OptimizeConsecutiveReshapesImpl::Run(), FuseBatchNorm< ConvLayer, ArmnnType, T >::Run(), and ErasedLayerNamesObservable::Update().

◆ GetNameStr()

const std::string& GetNameStr ( ) const
inline

◆ GetNumInputSlots()

◆ GetNumOutputSlots()

◆ GetOutputHandler() [1/2]

OutputHandler& GetOutputHandler ( unsigned int  i = 0)
inline

Definition at line 237 of file Layer.hpp.

238  {
239  return const_cast<OutputHandler&>(const_cast<const Layer*>(this)->GetOutputHandler(i));
240  }

References Layer::GetOutputHandler().

◆ GetOutputHandler() [2/2]

◆ GetOutputSlot() [1/2]

const OutputSlot& GetOutputSlot ( unsigned int  index = 0) const
inlineoverridevirtual

Get the const output slot handle by slot index.

Implements IConnectableLayer.

Examples
AsyncExecutionSample.cpp, and SimpleSample.cpp.

Definition at line 326 of file Layer.hpp.

326 { return m_OutputSlots.at(index); }

Referenced by Graph::AddCompatibilityLayers(), armnn::AttemptBackendAssignment(), OutputSlot::CalculateIndexOnOwner(), armnn::ChainReduceLayers(), armnn::CheckScaleSetOnQuantizedType(), SplitterLayer::CreateTensorHandles(), ConcatLayer::CreateTensorHandles(), Layer::CreateTensorHandles(), armnn::optimizations::pad_fold::FoldPadIntoLayer2dImpl(), GenerateUniqueOutputName(), Layer::GetDataType(), armnn::GetLayerInOutDatatype(), InputSlot::Insert(), armnn::InsertConvertFp16ToFp32LayersBefore(), armnn::InsertConvertFp32ToFp16LayersAfter(), armnn::InsertDebugLayerAfter(), IsConnected(), RefBackend::OptimizeSubgraphView(), ClBackend::OptimizeSubgraphView(), TransposeAsReshapeImpl::Run(), PermuteAsReshapeImpl::Run(), OptimizeConsecutiveReshapesImpl::Run(), PermuteAndBatchToSpaceAsDepthToSpaceImpl< PermuteType >::Run(), OptimizeInverseConversionsImpl::Run(), MovePermuteUpImpl::Run(), MoveTransposeUpImpl::Run(), FuseBatchNorm< ConvLayer, ArmnnType, T >::Run(), AddBroadcastReshapeLayerImpl::Run(), armnn::SelectTensorHandleStrategy(), Layer::ValidateAndCopyShape(), ElementwiseBaseLayer::ValidateTensorShapesFromInputs(), QuantizeLayer::ValidateTensorShapesFromInputs(), ActivationLayer::ValidateTensorShapesFromInputs(), ChannelShuffleLayer::ValidateTensorShapesFromInputs(), FillLayer::ValidateTensorShapesFromInputs(), ConvertFp32ToFp16Layer::ValidateTensorShapesFromInputs(), RankLayer::ValidateTensorShapesFromInputs(), StackLayer::ValidateTensorShapesFromInputs(), MemCopyLayer::ValidateTensorShapesFromInputs(), MergeLayer::ValidateTensorShapesFromInputs(), CastLayer::ValidateTensorShapesFromInputs(), FloorLayer::ValidateTensorShapesFromInputs(), SwitchLayer::ValidateTensorShapesFromInputs(), TransposeLayer::ValidateTensorShapesFromInputs(), InstanceNormalizationLayer::ValidateTensorShapesFromInputs(), ConvertFp16ToFp32Layer::ValidateTensorShapesFromInputs(), L2NormalizationLayer::ValidateTensorShapesFromInputs(), MemImportLayer::ValidateTensorShapesFromInputs(), SliceLayer::ValidateTensorShapesFromInputs(), DebugLayer::ValidateTensorShapesFromInputs(), BatchToSpaceNdLayer::ValidateTensorShapesFromInputs(), PermuteLayer::ValidateTensorShapesFromInputs(), Pooling2dLayer::ValidateTensorShapesFromInputs(), Pooling3dLayer::ValidateTensorShapesFromInputs(), DequantizeLayer::ValidateTensorShapesFromInputs(), NormalizationLayer::ValidateTensorShapesFromInputs(), AbsLayer::ValidateTensorShapesFromInputs(), ResizeLayer::ValidateTensorShapesFromInputs(), RsqrtLayer::ValidateTensorShapesFromInputs(), FakeQuantizationLayer::ValidateTensorShapesFromInputs(), ShapeLayer::ValidateTensorShapesFromInputs(), SoftmaxLayer::ValidateTensorShapesFromInputs(), LogSoftmaxLayer::ValidateTensorShapesFromInputs(), MeanLayer::ValidateTensorShapesFromInputs(), PadLayer::ValidateTensorShapesFromInputs(), ConstantLayer::ValidateTensorShapesFromInputs(), ReshapeLayer::ValidateTensorShapesFromInputs(), FullyConnectedLayer::ValidateTensorShapesFromInputs(), DepthwiseConvolution2dLayer::ValidateTensorShapesFromInputs(), Convolution3dLayer::ValidateTensorShapesFromInputs(), Convolution2dLayer::ValidateTensorShapesFromInputs(), GatherNdLayer::ValidateTensorShapesFromInputs(), ElementwiseBinaryLayer::ValidateTensorShapesFromInputs(), BatchMatMulLayer::ValidateTensorShapesFromInputs(), DetectionPostProcessLayer::ValidateTensorShapesFromInputs(), ArgMinMaxLayer::ValidateTensorShapesFromInputs(), GatherLayer::ValidateTensorShapesFromInputs(), ElementwiseUnaryLayer::ValidateTensorShapesFromInputs(), StridedSliceLayer::ValidateTensorShapesFromInputs(), ReduceLayer::ValidateTensorShapesFromInputs(), DepthToSpaceLayer::ValidateTensorShapesFromInputs(), SpaceToDepthLayer::ValidateTensorShapesFromInputs(), TransposeConvolution2dLayer::ValidateTensorShapesFromInputs(), SpaceToBatchNdLayer::ValidateTensorShapesFromInputs(), ComparisonLayer::ValidateTensorShapesFromInputs(), LogicalBinaryLayer::ValidateTensorShapesFromInputs(), PreluLayer::ValidateTensorShapesFromInputs(), SplitterLayer::ValidateTensorShapesFromInputs(), LstmLayer::ValidateTensorShapesFromInputs(), UnidirectionalSequenceLstmLayer::ValidateTensorShapesFromInputs(), ConcatLayer::ValidateTensorShapesFromInputs(), BatchNormalizationLayer::ValidateTensorShapesFromInputs(), QuantizedLstmLayer::ValidateTensorShapesFromInputs(), and QLstmLayer::ValidateTensorShapesFromInputs().

◆ GetOutputSlot() [2/2]

OutputSlot& GetOutputSlot ( unsigned int  index = 0)
inlineoverridevirtual

Get the output slot handle by slot index.

Implements IConnectableLayer.

Definition at line 327 of file Layer.hpp.

327 { return m_OutputSlots.at(index); }

◆ GetOutputSlots()

const std::vector<OutputSlot>& GetOutputSlots ( ) const
inline

◆ GetParameters()

◆ GetPriority()

LayerPriority GetPriority ( ) const

Definition at line 328 of file Layer.cpp.

329 {
330  constexpr LayerPriority inputPrio = std::numeric_limits<LayerPriority>::lowest();
331  constexpr LayerPriority outputPrio = std::numeric_limits<LayerPriority>::max();
332 
333  if (GetType() == LayerType::Input)
334  {
335  m_Priority = inputPrio;
336  }
337  else if (GetType() == LayerType::Output)
338  {
339  m_Priority = outputPrio;
340  }
341  else if (m_Priority == 0)
342  {
343  if (m_Visiting)
344  {
345  throw GraphValidationException("Graph has circular dependencies: cannot walk");
346  }
347 
348  auto maxPrio = [](const LayerPriority prio, const InputSlot& slot) -> LayerPriority
349  {
350  const OutputSlot *outputSlot = slot.GetConnectedOutputSlot();
351  if (outputSlot)
352  {
353  const Layer& input = outputSlot->GetOwningLayer();
354  return std::max(prio, input.GetPriority());
355  }
356  else
357  {
358  // unconnected input slot
359  return prio;
360  }
361  };
362 
363  m_Visiting = true;
364  LayerPriority parentPrio = std::accumulate(GetInputSlots().cbegin(), GetInputSlots().cend(), 0U, maxPrio);
365  m_Visiting = false;
366 
367  if (parentPrio >= outputPrio)
368  {
369  throw GraphValidationException("Graph has too many edges");
370  }
371 
372  m_Priority = parentPrio + 1U;
373  }
374 
375  return m_Priority;
376 }

References Layer::GetInputSlots(), OutputSlot::GetOwningLayer(), Layer::GetPriority(), Layer::GetType(), armnn::Input, and armnn::Output.

Referenced by Layer::GetPriority(), and SquashEqualSiblingsImpl< Comparable >::Run().

◆ GetRelatedLayerNames()

const std::list<std::string>& GetRelatedLayerNames ( )
inline

Definition at line 334 of file Layer.hpp.

334 { return m_RelatedLayerNames; }

Referenced by ErasedLayerNamesObservable::Update().

◆ GetShapeInferenceMethod()

ShapeInferenceMethod GetShapeInferenceMethod ( ) const
inline

Definition at line 242 of file Layer.hpp.

242 { return m_ShapeInferenceMethod; };

References Layer::m_ShapeInferenceMethod.

◆ GetType()

LayerType GetType ( ) const
inlineoverridevirtual

Returns the armnn::LayerType of this layer.

Implements IConnectableLayer.

Definition at line 273 of file Layer.hpp.

273 { return m_Type; }

Referenced by armnn::ApplyBackendOptimizations(), armnn::AssertNumberOfInputSlots(), armnn::AttemptBackendAssignment(), armnn::CalculateEdgeStrategy(), armnn::CalculateSlotOption(), armnn::CalculateSlotOptionForInput(), armnn::CheckScaleSetOnQuantizedType(), GenerateUniqueName(), GenerateUniqueOutputName(), Layer::GetPriority(), GetTosaMappingFromLayer(), LoadedNetwork::ImportInputs(), LoadedNetwork::ImportOutputs(), Layer::InferOutputShapes(), ReshapeLayer::IsEqual(), TransposeLayer::IsEqual(), PermuteLayer::IsEqual(), TransposeLayer::IsInverse(), PermuteLayer::IsInverse(), IsLayerOfType(), armnn::IsLayerSupported(), TosaRefBackend::OptimizeSubgraphView(), RefBackend::OptimizeSubgraphView(), NeonBackend::OptimizeSubgraphView(), ClBackend::OptimizeSubgraphView(), armnn::ReturnWithError(), ConvertFp32NetworkToFp16Impl::Run(), AddDebugImpl::Run(), OptimizeConsecutiveReshapesImpl::Run(), ConvertConstPermuteLayersToConstLayers::Run(), OptimizeInverseConversionsImpl::Run(), ConvertConstDequantisationLayersToConstLayersImpl::Run(), PermuteAndBatchToSpaceAsDepthToSpaceImpl< PermuteType >::Run(), PermuteDepthwiseConv2dWeightsImpl::Run(), AddBroadcastReshapeLayerImpl::Run(), FuseBatchNorm< ConvLayer, ArmnnType, T >::Run(), OptimizeForTypeImpl< BaseType, OptimizeForConnectionImpl< BaseType, ChildType, Wrapped > >::Run(), AddDebugToFileImpl::Run(), armnn::SelectTensorHandleStrategy(), ElementwiseBaseLayer::ValidateTensorShapesFromInputs(), ElementwiseBinaryLayer::ValidateTensorShapesFromInputs(), ElementwiseUnaryLayer::ValidateTensorShapesFromInputs(), and Layer::VerifyLayerConnections().

◆ InferOutputShapes()

std::vector< TensorShape > InferOutputShapes ( const std::vector< TensorShape > &  inputShapes) const
overridevirtual

Infer the shape of the output(s) based on the provided input shape(s)

Implements IConnectableLayer.

Reimplemented in QLstmLayer, QuantizedLstmLayer, ConcatLayer, LstmLayer, UnidirectionalSequenceLstmLayer, SplitterLayer, DetectionPostProcessLayer, TransposeConvolution2dLayer, Convolution2dLayer, Convolution3dLayer, DepthwiseConvolution2dLayer, FullyConnectedLayer, ConstantLayer, ReshapeLayer, MeanLayer, PadLayer, StandInLayer, BatchToSpaceNdLayer, PermuteLayer, Pooling2dLayer, Pooling3dLayer, ResizeLayer, ShapeLayer, SliceLayer, StackLayer, MergeLayer, RankLayer, TransposeLayer, ComparisonLayer, DepthToSpaceLayer, LogicalBinaryLayer, PreluLayer, ReduceLayer, SpaceToBatchNdLayer, SpaceToDepthLayer, ArgMinMaxLayer, ElementwiseBinaryLayer, ElementwiseUnaryLayer, GatherLayer, StridedSliceLayer, BatchMatMulLayer, GatherNdLayer, and ElementwiseBaseLayer.

Definition at line 397 of file Layer.cpp.

398 {
401 
402  // By default we return what we got, meaning the output shape(s) are the same as the input(s).
403  // This only works if the number of inputs and outputs are the same. Since we are in the Layer
404  // base class, this means the implementation needs to be overridden in the specific layers for
405  // the other cases. So the missing implementation justifies the UnimplementedException.
406 
408  {
409  throw UnimplementedException(
410  fmt::format("Default implementation for InferOutputShapes can only be used for "
411  "layers with the same number of input and output slots. This doesn't "
412  "hold for {0} layer {1} (#inputs={2} #outputs={3}) {4}",
414  GetNameStr(),
417  CHECK_LOCATION().AsString()));
418  }
419  return inputShapes;
420 }

References ARMNN_ASSERT, CHECK_LOCATION, armnn::GetLayerTypeAsCString(), Layer::GetNameStr(), Layer::GetNumInputSlots(), Layer::GetNumOutputSlots(), and Layer::GetType().

Referenced by QuantizeLayer::ValidateTensorShapesFromInputs(), ActivationLayer::ValidateTensorShapesFromInputs(), ChannelShuffleLayer::ValidateTensorShapesFromInputs(), FillLayer::ValidateTensorShapesFromInputs(), ConvertFp32ToFp16Layer::ValidateTensorShapesFromInputs(), NormalizationLayer::ValidateTensorShapesFromInputs(), MemImportLayer::ValidateTensorShapesFromInputs(), MemCopyLayer::ValidateTensorShapesFromInputs(), RsqrtLayer::ValidateTensorShapesFromInputs(), L2NormalizationLayer::ValidateTensorShapesFromInputs(), InstanceNormalizationLayer::ValidateTensorShapesFromInputs(), SwitchLayer::ValidateTensorShapesFromInputs(), AbsLayer::ValidateTensorShapesFromInputs(), FakeQuantizationLayer::ValidateTensorShapesFromInputs(), DebugLayer::ValidateTensorShapesFromInputs(), CastLayer::ValidateTensorShapesFromInputs(), ConvertFp16ToFp32Layer::ValidateTensorShapesFromInputs(), FloorLayer::ValidateTensorShapesFromInputs(), SoftmaxLayer::ValidateTensorShapesFromInputs(), DequantizeLayer::ValidateTensorShapesFromInputs(), LogSoftmaxLayer::ValidateTensorShapesFromInputs(), and BatchNormalizationLayer::ValidateTensorShapesFromInputs().

◆ IsOutputUnconnected()

bool IsOutputUnconnected ( )
inline

Definition at line 257 of file Layer.hpp.

258  {
259  unsigned int numConnections = 0;
260 
261  for (auto&& output : GetOutputSlots())
262  {
263  numConnections += output.GetNumConnections();
264  }
265 
266  return (GetNumOutputSlots() > 0) && (numConnections == 0);
267  }

References Layer::GetNumOutputSlots(), and Layer::GetOutputSlots().

Referenced by OptimizeForConnectionImpl< BaseType, ChildType, Wrapped >::Run(), and OptimizeForExclusiveConnectionImpl< BaseType, ChildType, Wrapped >::Run().

◆ OperateOnConstantTensors()

void OperateOnConstantTensors ( Op  op)
inline

Definition at line 306 of file Layer.hpp.

307  {
308  for (auto constant : GetConstantTensorsByRef())
309  {
310  if (constant.get())
311  {
312  op(constant);
313  }
314  }
315  };

References Layer::GetConstantTensorsByRef().

Referenced by Layer::ReleaseConstantData(), and ConvertConstants< Converter, Predicate >::Run().

◆ PrepInfoAndDesc()

◆ ReleaseConstantData()

void ReleaseConstantData ( )
virtual

Reimplemented in Convolution2dLayer, DepthwiseConvolution2dLayer, FullyConnectedLayer, and ConstantLayer.

Definition at line 304 of file Layer.cpp.

305 {
306  // Now free up the static data.
307  OperateOnConstantTensors([](std::shared_ptr<ConstTensorHandle>& handle)
308  {
309  handle.reset();
310  });
311 }

References Layer::OperateOnConstantTensors().

◆ Reparent()

virtual void Reparent ( Graph dest,
std::list< Layer * >::const_iterator  iterator 
)
pure virtual

Referenced by Graph::operator=().

◆ ResetPriority()

void ResetPriority ( ) const

Definition at line 322 of file Layer.cpp.

323 {
324  m_Priority = 0;
325  m_Visiting = false;
326 }

◆ SerializeLayerParameters()

void SerializeLayerParameters ( ParameterStringifyFunction fn) const
virtual

Helper to serialize the layer parameters to string.

(currently used in DotSerializer and company).

Reimplemented in Convolution2dLayer, Convolution3dLayer, DepthwiseConvolution2dLayer, LayerWithParameters< Parameters >, LayerWithParameters< SoftmaxDescriptor >, LayerWithParameters< FakeQuantizationDescriptor >, LayerWithParameters< ReduceDescriptor >, LayerWithParameters< LstmDescriptor >, LayerWithParameters< ChannelShuffleDescriptor >, LayerWithParameters< PreCompiledDescriptor >, LayerWithParameters< LogSoftmaxDescriptor >, LayerWithParameters< SpaceToBatchNdDescriptor >, LayerWithParameters< BatchToSpaceNdDescriptor >, LayerWithParameters< PermuteDescriptor >, LayerWithParameters< GatherDescriptor >, LayerWithParameters< ElementwiseUnaryDescriptor >, LayerWithParameters< DepthToSpaceDescriptor >, LayerWithParameters< SpaceToDepthDescriptor >, LayerWithParameters< OriginsDescriptor >, LayerWithParameters< ReshapeDescriptor >, LayerWithParameters< ViewsDescriptor >, LayerWithParameters< Pooling2dDescriptor >, LayerWithParameters< StandInDescriptor >, LayerWithParameters< Convolution2dDescriptor >, LayerWithParameters< ActivationDescriptor >, LayerWithParameters< MeanDescriptor >, LayerWithParameters< StackDescriptor >, LayerWithParameters< TransposeDescriptor >, LayerWithParameters< InstanceNormalizationDescriptor >, LayerWithParameters< ComparisonDescriptor >, LayerWithParameters< TransposeConvolution2dDescriptor >, LayerWithParameters< BatchNormalizationDescriptor >, LayerWithParameters< BatchMatMulDescriptor >, LayerWithParameters< ArgMinMaxDescriptor >, LayerWithParameters< LogicalBinaryDescriptor >, LayerWithParameters< DetectionPostProcessDescriptor >, LayerWithParameters< PadDescriptor >, LayerWithParameters< L2NormalizationDescriptor >, LayerWithParameters< Convolution3dDescriptor >, LayerWithParameters< SliceDescriptor >, LayerWithParameters< QLstmDescriptor >, LayerWithParameters< FillDescriptor >, LayerWithParameters< DepthwiseConvolution2dDescriptor >, LayerWithParameters< NormalizationDescriptor >, LayerWithParameters< FullyConnectedDescriptor >, LayerWithParameters< ResizeDescriptor >, LayerWithParameters< Pooling3dDescriptor >, LayerWithParameters< ElementwiseBinaryDescriptor >, and LayerWithParameters< StridedSliceDescriptor >.

Definition at line 505 of file Layer.cpp.

506 {
507  std::string guid = std::to_string(m_Guid);
508  std::string layerType = GetLayerTypeAsCString(m_Type);
509  std::string backendId = std::string(m_BackendId);
510  if (!(guid.compare("") == 0) && !guid.empty())
511  {
512  fn("Guid", guid);
513  }
514  if(!(m_LayerName.compare("") == 0) && !m_LayerName.empty())
515  {
516  fn("LayerName",m_LayerName);
517  }
518  if(!(layerType.compare("") == 0) && !layerType.empty())
519  {
520  fn("LayerType",layerType);
521  }
522  if(!(backendId.compare("") == 0) && !backendId.empty())
523  {
524  fn("BackendID",backendId);
525  }
526  std::shared_ptr<ActivationDescriptor>
527  activationDescPtr = GetAdditionalInformation<ActivationDescriptor>();
528 
529  if (activationDescPtr)
530  {
531  StringifyLayerParameters<ActivationDescriptor>::Serialize(fn, *activationDescPtr.get());
532  }
533 }

References armnn::GetLayerTypeAsCString(), and StringifyLayerParameters< LayerParameter >::Serialize().

Referenced by LayerWithParameters< StridedSliceDescriptor >::SerializeLayerParameters().

◆ SetAdditionalInfo()

void SetAdditionalInfo ( QueueDescriptor descriptor) const
protected

Definition at line 274 of file Layer.cpp.

275 {
276  descriptor.m_AdditionalInfoObject = m_AdditionalInfoObject.get();
277 }

References QueueDescriptor::m_AdditionalInfoObject, and Layer::m_AdditionalInfoObject.

Referenced by ActivationLayer::CreateWorkload(), ConvertFp32ToFp16Layer::CreateWorkload(), FillLayer::CreateWorkload(), QuantizeLayer::CreateWorkload(), RankLayer::CreateWorkload(), AbsLayer::CreateWorkload(), CastLayer::CreateWorkload(), StridedSliceLayer::CreateWorkload(), StackLayer::CreateWorkload(), DebugLayer::CreateWorkload(), SwitchLayer::CreateWorkload(), MapLayer::CreateWorkload(), SoftmaxLayer::CreateWorkload(), SliceLayer::CreateWorkload(), UnmapLayer::CreateWorkload(), RsqrtLayer::CreateWorkload(), MemCopyLayer::CreateWorkload(), MemImportLayer::CreateWorkload(), BatchMatMulLayer::CreateWorkload(), DequantizeLayer::CreateWorkload(), NormalizationLayer::CreateWorkload(), ConcatLayer::CreateWorkload(), Pooling2dLayer::CreateWorkload(), Pooling3dLayer::CreateWorkload(), FakeQuantizationLayer::CreateWorkload(), ConvertFp16ToFp32Layer::CreateWorkload(), FloorLayer::CreateWorkload(), ResizeLayer::CreateWorkload(), AdditionLayer::CreateWorkload(), BatchToSpaceNdLayer::CreateWorkload(), ShapeLayer::CreateWorkload(), GatherNdLayer::CreateWorkload(), InstanceNormalizationLayer::CreateWorkload(), SplitterLayer::CreateWorkload(), L2NormalizationLayer::CreateWorkload(), MaximumLayer::CreateWorkload(), PreluLayer::CreateWorkload(), SubtractionLayer::CreateWorkload(), LogSoftmaxLayer::CreateWorkload(), TransposeLayer::CreateWorkload(), SpaceToDepthLayer::CreateWorkload(), GatherLayer::CreateWorkload(), DepthToSpaceLayer::CreateWorkload(), SpaceToBatchNdLayer::CreateWorkload(), MultiplicationLayer::CreateWorkload(), ComparisonLayer::CreateWorkload(), PadLayer::CreateWorkload(), DivisionLayer::CreateWorkload(), ElementwiseBinaryLayer::CreateWorkload(), ArgMinMaxLayer::CreateWorkload(), ReduceLayer::CreateWorkload(), MeanLayer::CreateWorkload(), PermuteLayer::CreateWorkload(), MinimumLayer::CreateWorkload(), ConstantLayer::CreateWorkload(), ReshapeLayer::CreateWorkload(), ChannelShuffleLayer::CreateWorkload(), Convolution2dLayer::CreateWorkload(), Convolution3dLayer::CreateWorkload(), DepthwiseConvolution2dLayer::CreateWorkload(), FullyConnectedLayer::CreateWorkload(), DetectionPostProcessLayer::CreateWorkload(), TransposeConvolution2dLayer::CreateWorkload(), PreCompiledLayer::CreateWorkload(), UnidirectionalSequenceLstmLayer::CreateWorkload(), LstmLayer::CreateWorkload(), BatchNormalizationLayer::CreateWorkload(), QuantizedLstmLayer::CreateWorkload(), and QLstmLayer::CreateWorkload().

◆ SetAdditionalInfoForObject()

void SetAdditionalInfoForObject ( const AdditionalInfoObjectPtr additionalInfo)
inline

Definition at line 360 of file Layer.hpp.

361  {
362  m_AdditionalInfoObject = additionalInfo;
363  }

References Layer::m_AdditionalInfoObject.

◆ SetAllowExpandedDims()

void SetAllowExpandedDims ( bool  allowExpandedDims)
inline

Definition at line 349 of file Layer.hpp.

350  {
351  m_AllowExpandedDims = allowExpandedDims;
352  }

◆ SetBackendId()

void SetBackendId ( const BackendId id)
inlineoverridevirtual

Set the backend of the IConnectableLayer.

By using SetBackendId() we guarantee that the input backend supports that layer (IsLayerSupported returns true for a specific backend). If there is no guarantee the input backend supports that layer use BackendSelectionHint().

Implements IConnectableLayer.

Definition at line 278 of file Layer.hpp.

278 { m_BackendId = id; }

Referenced by Graph::AddCompatibilityLayers(), NetworkImpl::AddPrecompiledLayer(), armnn::AttemptBackendAssignment(), and armnn::InsertDebugLayerAfter().

◆ SetGuid()

void SetGuid ( LayerGuid  guid)
inline

Definition at line 329 of file Layer.hpp.

329 { m_Guid = guid; }

◆ SetShapeInferenceMethod()

void SetShapeInferenceMethod ( ShapeInferenceMethod  shapeInferenceMethod)
inline

Definition at line 344 of file Layer.hpp.

345  {
346  m_ShapeInferenceMethod = shapeInferenceMethod;
347  }

References Layer::m_ShapeInferenceMethod.

◆ ValidateAndCopyShape()

void ValidateAndCopyShape ( const TensorShape outputShape,
const TensorShape inferredShape,
const ShapeInferenceMethod  shapeInferenceMethod,
const std::string &  layerName,
const unsigned int  outputSlotIndex = 0 
)
protected

Definition at line 422 of file Layer.cpp.

427 {
428  if (shapeInferenceMethod == ShapeInferenceMethod::ValidateOnly)
429  {
430  if (m_AllowExpandedDims)
431  {
432  std::vector<unsigned int> outputDims = armnnUtils::SqueezeDims(outputShape);
433  std::vector<unsigned int> inferredDims = armnnUtils::SqueezeDims(inferredShape);
434 
435  if (outputDims.size() != inferredDims.size())
436  {
437  std::stringstream ss;
438  ss << layerName << ": TensorShape set on OutputSlot[" << outputSlotIndex <<
439  "] does not match the inferred shape. ";
440  ss << outputShape << " != " << inferredShape;
441  throw LayerValidationException(ss.str());
442  }
443  for (unsigned int i = 0; i < outputDims.size(); ++i)
444  {
445  if (outputDims[i] != inferredDims[i])
446  {
447  std::stringstream ss;
448  ss << layerName << ": TensorShape set on OutputSlot[" << outputSlotIndex <<
449  "] does not match the inferred shape at dimension index [";
450  ss << i << "] " << outputShape << " != " << inferredShape;
451  throw LayerValidationException(ss.str());
452  }
453  }
454  return;
455  }
456  else
457  {
458  ConditionalThrowIfNotEqual<LayerValidationException>(
459  layerName + ": TensorShape set on OutputSlot[0] does not match the inferred shape.",
460  outputShape,
461  inferredShape);
462  return;
463  }
464  }
465 
466  if (outputShape.GetDimensionality() == Dimensionality::Specified)
467  {
468  for (unsigned int i = 0; i < outputShape.GetNumDimensions(); ++i)
469  {
470  if (outputShape.GetDimensionSpecificity(i) && outputShape[i] != inferredShape[i])
471  {
472  std::stringstream ss;
473  ss << layerName << ": TensorShape set on OutputSlot[" << outputSlotIndex <<
474  "] does not match the inferred shape at dimension index [";
475  ss << i << "] " << outputShape << " != " << inferredShape;
476  throw LayerValidationException(ss.str());
477  }
478  }
479  }
480 
481  TensorInfo info = GetOutputSlot(outputSlotIndex).GetTensorInfo();
482 
483  armnn::TensorInfo inferredTensorInfo(inferredShape,
484  info.GetDataType(),
485  info.GetQuantizationScale(),
486  info.GetQuantizationOffset());
487 
488  GetOutputSlot(outputSlotIndex).SetTensorInfo(inferredTensorInfo);
489 }

References TensorShape::GetDimensionality(), TensorShape::GetDimensionSpecificity(), TensorShape::GetNumDimensions(), Layer::GetOutputSlot(), OutputSlot::GetTensorInfo(), armnn::info, OutputSlot::SetTensorInfo(), armnn::Specified, armnnUtils::SqueezeDims(), and armnn::ValidateOnly.

Referenced by ElementwiseBaseLayer::ValidateTensorShapesFromInputs(), QuantizeLayer::ValidateTensorShapesFromInputs(), ActivationLayer::ValidateTensorShapesFromInputs(), ChannelShuffleLayer::ValidateTensorShapesFromInputs(), RankLayer::ValidateTensorShapesFromInputs(), ConvertFp32ToFp16Layer::ValidateTensorShapesFromInputs(), SwitchLayer::ValidateTensorShapesFromInputs(), AbsLayer::ValidateTensorShapesFromInputs(), MemCopyLayer::ValidateTensorShapesFromInputs(), MemImportLayer::ValidateTensorShapesFromInputs(), DequantizeLayer::ValidateTensorShapesFromInputs(), MergeLayer::ValidateTensorShapesFromInputs(), ShapeLayer::ValidateTensorShapesFromInputs(), NormalizationLayer::ValidateTensorShapesFromInputs(), PermuteLayer::ValidateTensorShapesFromInputs(), ConvertFp16ToFp32Layer::ValidateTensorShapesFromInputs(), Pooling2dLayer::ValidateTensorShapesFromInputs(), Pooling3dLayer::ValidateTensorShapesFromInputs(), FakeQuantizationLayer::ValidateTensorShapesFromInputs(), BatchToSpaceNdLayer::ValidateTensorShapesFromInputs(), FloorLayer::ValidateTensorShapesFromInputs(), ResizeLayer::ValidateTensorShapesFromInputs(), RsqrtLayer::ValidateTensorShapesFromInputs(), SliceLayer::ValidateTensorShapesFromInputs(), SoftmaxLayer::ValidateTensorShapesFromInputs(), CastLayer::ValidateTensorShapesFromInputs(), InstanceNormalizationLayer::ValidateTensorShapesFromInputs(), StackLayer::ValidateTensorShapesFromInputs(), L2NormalizationLayer::ValidateTensorShapesFromInputs(), DebugLayer::ValidateTensorShapesFromInputs(), TransposeLayer::ValidateTensorShapesFromInputs(), MeanLayer::ValidateTensorShapesFromInputs(), PadLayer::ValidateTensorShapesFromInputs(), LogSoftmaxLayer::ValidateTensorShapesFromInputs(), ReshapeLayer::ValidateTensorShapesFromInputs(), FullyConnectedLayer::ValidateTensorShapesFromInputs(), DepthwiseConvolution2dLayer::ValidateTensorShapesFromInputs(), Convolution3dLayer::ValidateTensorShapesFromInputs(), Convolution2dLayer::ValidateTensorShapesFromInputs(), GatherNdLayer::ValidateTensorShapesFromInputs(), ElementwiseBinaryLayer::ValidateTensorShapesFromInputs(), BatchMatMulLayer::ValidateTensorShapesFromInputs(), ElementwiseUnaryLayer::ValidateTensorShapesFromInputs(), DetectionPostProcessLayer::ValidateTensorShapesFromInputs(), StridedSliceLayer::ValidateTensorShapesFromInputs(), ArgMinMaxLayer::ValidateTensorShapesFromInputs(), ReduceLayer::ValidateTensorShapesFromInputs(), GatherLayer::ValidateTensorShapesFromInputs(), DepthToSpaceLayer::ValidateTensorShapesFromInputs(), SpaceToDepthLayer::ValidateTensorShapesFromInputs(), SpaceToBatchNdLayer::ValidateTensorShapesFromInputs(), TransposeConvolution2dLayer::ValidateTensorShapesFromInputs(), ComparisonLayer::ValidateTensorShapesFromInputs(), PreluLayer::ValidateTensorShapesFromInputs(), LogicalBinaryLayer::ValidateTensorShapesFromInputs(), SplitterLayer::ValidateTensorShapesFromInputs(), ConcatLayer::ValidateTensorShapesFromInputs(), LstmLayer::ValidateTensorShapesFromInputs(), UnidirectionalSequenceLstmLayer::ValidateTensorShapesFromInputs(), BatchNormalizationLayer::ValidateTensorShapesFromInputs(), QuantizedLstmLayer::ValidateTensorShapesFromInputs(), and QLstmLayer::ValidateTensorShapesFromInputs().

◆ ValidateTensorShapesFromInputs()

◆ VerifyLayerConnections()

void VerifyLayerConnections ( unsigned int  expectedConnections,
const CheckLocation location 
) const

Definition at line 378 of file Layer.cpp.

379 {
380  ARMNN_ASSERT(GetNumInputSlots() == expectedConnections);
381 
382  for (unsigned int i=0; i<expectedConnections; ++i)
383  {
384  if (GetInputSlot(i).GetConnection() == nullptr)
385  {
386  throw LayerValidationException(
387  fmt::format("Input connection #{0} must be connected "
388  "for {1} layer {2} {3}",
389  i,
391  GetNameStr(),
392  location.AsString()));
393  }
394  }
395 }

References ARMNN_ASSERT, CheckLocation::AsString(), Layer::GetInputSlot(), armnn::GetLayerTypeAsCString(), Layer::GetNameStr(), Layer::GetNumInputSlots(), and Layer::GetType().

Referenced by ElementwiseBaseLayer::ValidateTensorShapesFromInputs(), QuantizeLayer::ValidateTensorShapesFromInputs(), ActivationLayer::ValidateTensorShapesFromInputs(), ChannelShuffleLayer::ValidateTensorShapesFromInputs(), RankLayer::ValidateTensorShapesFromInputs(), ConvertFp32ToFp16Layer::ValidateTensorShapesFromInputs(), FillLayer::ValidateTensorShapesFromInputs(), AbsLayer::ValidateTensorShapesFromInputs(), MapLayer::ValidateTensorShapesFromInputs(), MemCopyLayer::ValidateTensorShapesFromInputs(), DequantizeLayer::ValidateTensorShapesFromInputs(), MemImportLayer::ValidateTensorShapesFromInputs(), MergeLayer::ValidateTensorShapesFromInputs(), RsqrtLayer::ValidateTensorShapesFromInputs(), NormalizationLayer::ValidateTensorShapesFromInputs(), ConvertFp16ToFp32Layer::ValidateTensorShapesFromInputs(), PermuteLayer::ValidateTensorShapesFromInputs(), Pooling2dLayer::ValidateTensorShapesFromInputs(), Pooling3dLayer::ValidateTensorShapesFromInputs(), FakeQuantizationLayer::ValidateTensorShapesFromInputs(), SwitchLayer::ValidateTensorShapesFromInputs(), BatchToSpaceNdLayer::ValidateTensorShapesFromInputs(), FloorLayer::ValidateTensorShapesFromInputs(), ResizeLayer::ValidateTensorShapesFromInputs(), ShapeLayer::ValidateTensorShapesFromInputs(), SliceLayer::ValidateTensorShapesFromInputs(), SoftmaxLayer::ValidateTensorShapesFromInputs(), CastLayer::ValidateTensorShapesFromInputs(), InstanceNormalizationLayer::ValidateTensorShapesFromInputs(), StackLayer::ValidateTensorShapesFromInputs(), L2NormalizationLayer::ValidateTensorShapesFromInputs(), DebugLayer::ValidateTensorShapesFromInputs(), TransposeLayer::ValidateTensorShapesFromInputs(), UnmapLayer::ValidateTensorShapesFromInputs(), MeanLayer::ValidateTensorShapesFromInputs(), PadLayer::ValidateTensorShapesFromInputs(), LogSoftmaxLayer::ValidateTensorShapesFromInputs(), ReshapeLayer::ValidateTensorShapesFromInputs(), DepthwiseConvolution2dLayer::ValidateTensorShapesFromInputs(), Convolution3dLayer::ValidateTensorShapesFromInputs(), Convolution2dLayer::ValidateTensorShapesFromInputs(), GatherNdLayer::ValidateTensorShapesFromInputs(), ElementwiseBinaryLayer::ValidateTensorShapesFromInputs(), BatchMatMulLayer::ValidateTensorShapesFromInputs(), GatherLayer::ValidateTensorShapesFromInputs(), StridedSliceLayer::ValidateTensorShapesFromInputs(), ReduceLayer::ValidateTensorShapesFromInputs(), ElementwiseUnaryLayer::ValidateTensorShapesFromInputs(), ArgMinMaxLayer::ValidateTensorShapesFromInputs(), DetectionPostProcessLayer::ValidateTensorShapesFromInputs(), ComparisonLayer::ValidateTensorShapesFromInputs(), DepthToSpaceLayer::ValidateTensorShapesFromInputs(), SpaceToBatchNdLayer::ValidateTensorShapesFromInputs(), SpaceToDepthLayer::ValidateTensorShapesFromInputs(), TransposeConvolution2dLayer::ValidateTensorShapesFromInputs(), PreluLayer::ValidateTensorShapesFromInputs(), LogicalBinaryLayer::ValidateTensorShapesFromInputs(), ConcatLayer::ValidateTensorShapesFromInputs(), LstmLayer::ValidateTensorShapesFromInputs(), UnidirectionalSequenceLstmLayer::ValidateTensorShapesFromInputs(), BatchNormalizationLayer::ValidateTensorShapesFromInputs(), QuantizedLstmLayer::ValidateTensorShapesFromInputs(), and QLstmLayer::ValidateTensorShapesFromInputs().

◆ VerifyShapeInferenceType()

void VerifyShapeInferenceType ( const TensorShape outputShape,
ShapeInferenceMethod  shapeInferenceMethod 
)
protected

Definition at line 491 of file Layer.cpp.

492 {
493  if (shapeInferenceMethod == ShapeInferenceMethod::ValidateOnly)
494  {
495  ConditionalThrow<LayerValidationException>(
496  outputShape.GetDimensionality() != Dimensionality::NotSpecified,
497  "Dimensionality can not be NotSpecified while using ShapeInferenceMethod::ValidateOnly");
498 
499  ConditionalThrow<LayerValidationException>(
500  outputShape.AreAllDimensionsSpecified(),
501  "Unspecified dimension while using ShapeInferenceMethod::ValidateOnly");
502  }
503 }

References TensorShape::AreAllDimensionsSpecified(), TensorShape::GetDimensionality(), armnn::NotSpecified, and armnn::ValidateOnly.

Referenced by ElementwiseBaseLayer::ValidateTensorShapesFromInputs(), QuantizeLayer::ValidateTensorShapesFromInputs(), ActivationLayer::ValidateTensorShapesFromInputs(), ChannelShuffleLayer::ValidateTensorShapesFromInputs(), RankLayer::ValidateTensorShapesFromInputs(), ConvertFp32ToFp16Layer::ValidateTensorShapesFromInputs(), FillLayer::ValidateTensorShapesFromInputs(), SwitchLayer::ValidateTensorShapesFromInputs(), AbsLayer::ValidateTensorShapesFromInputs(), MemCopyLayer::ValidateTensorShapesFromInputs(), DequantizeLayer::ValidateTensorShapesFromInputs(), MemImportLayer::ValidateTensorShapesFromInputs(), MergeLayer::ValidateTensorShapesFromInputs(), NormalizationLayer::ValidateTensorShapesFromInputs(), ConvertFp16ToFp32Layer::ValidateTensorShapesFromInputs(), PermuteLayer::ValidateTensorShapesFromInputs(), Pooling2dLayer::ValidateTensorShapesFromInputs(), Pooling3dLayer::ValidateTensorShapesFromInputs(), FakeQuantizationLayer::ValidateTensorShapesFromInputs(), BatchToSpaceNdLayer::ValidateTensorShapesFromInputs(), FloorLayer::ValidateTensorShapesFromInputs(), ResizeLayer::ValidateTensorShapesFromInputs(), RsqrtLayer::ValidateTensorShapesFromInputs(), ShapeLayer::ValidateTensorShapesFromInputs(), SliceLayer::ValidateTensorShapesFromInputs(), SoftmaxLayer::ValidateTensorShapesFromInputs(), CastLayer::ValidateTensorShapesFromInputs(), InstanceNormalizationLayer::ValidateTensorShapesFromInputs(), StackLayer::ValidateTensorShapesFromInputs(), DebugLayer::ValidateTensorShapesFromInputs(), L2NormalizationLayer::ValidateTensorShapesFromInputs(), TransposeLayer::ValidateTensorShapesFromInputs(), LogSoftmaxLayer::ValidateTensorShapesFromInputs(), MeanLayer::ValidateTensorShapesFromInputs(), PadLayer::ValidateTensorShapesFromInputs(), ReshapeLayer::ValidateTensorShapesFromInputs(), DepthwiseConvolution2dLayer::ValidateTensorShapesFromInputs(), FullyConnectedLayer::ValidateTensorShapesFromInputs(), Convolution2dLayer::ValidateTensorShapesFromInputs(), Convolution3dLayer::ValidateTensorShapesFromInputs(), GatherNdLayer::ValidateTensorShapesFromInputs(), ElementwiseBinaryLayer::ValidateTensorShapesFromInputs(), BatchMatMulLayer::ValidateTensorShapesFromInputs(), ElementwiseUnaryLayer::ValidateTensorShapesFromInputs(), DetectionPostProcessLayer::ValidateTensorShapesFromInputs(), ArgMinMaxLayer::ValidateTensorShapesFromInputs(), StridedSliceLayer::ValidateTensorShapesFromInputs(), ReduceLayer::ValidateTensorShapesFromInputs(), GatherLayer::ValidateTensorShapesFromInputs(), LogicalBinaryLayer::ValidateTensorShapesFromInputs(), ComparisonLayer::ValidateTensorShapesFromInputs(), SpaceToBatchNdLayer::ValidateTensorShapesFromInputs(), DepthToSpaceLayer::ValidateTensorShapesFromInputs(), TransposeConvolution2dLayer::ValidateTensorShapesFromInputs(), PreluLayer::ValidateTensorShapesFromInputs(), SpaceToDepthLayer::ValidateTensorShapesFromInputs(), SplitterLayer::ValidateTensorShapesFromInputs(), ConcatLayer::ValidateTensorShapesFromInputs(), LstmLayer::ValidateTensorShapesFromInputs(), UnidirectionalSequenceLstmLayer::ValidateTensorShapesFromInputs(), BatchNormalizationLayer::ValidateTensorShapesFromInputs(), QuantizedLstmLayer::ValidateTensorShapesFromInputs(), and QLstmLayer::ValidateTensorShapesFromInputs().

Friends And Related Function Documentation

◆ Graph

friend class Graph
friend

Definition at line 369 of file Layer.hpp.

Member Data Documentation

◆ m_AdditionalInfoObject

AdditionalInfoObjectPtr m_AdditionalInfoObject
protected

◆ m_OutputHandlers

std::vector<OutputHandler> m_OutputHandlers
protected

Definition at line 426 of file Layer.hpp.

Referenced by Layer::GetOutputHandler(), and Layer::Layer().

◆ m_ShapeInferenceMethod

ShapeInferenceMethod m_ShapeInferenceMethod
protected

Definition at line 427 of file Layer.hpp.

Referenced by Layer::CloneBase(), Layer::GetShapeInferenceMethod(), Layer::SetShapeInferenceMethod(), ElementwiseBaseLayer::ValidateTensorShapesFromInputs(), QuantizeLayer::ValidateTensorShapesFromInputs(), ActivationLayer::ValidateTensorShapesFromInputs(), ChannelShuffleLayer::ValidateTensorShapesFromInputs(), ConvertFp32ToFp16Layer::ValidateTensorShapesFromInputs(), FillLayer::ValidateTensorShapesFromInputs(), RankLayer::ValidateTensorShapesFromInputs(), BatchToSpaceNdLayer::ValidateTensorShapesFromInputs(), TransposeLayer::ValidateTensorShapesFromInputs(), ShapeLayer::ValidateTensorShapesFromInputs(), RsqrtLayer::ValidateTensorShapesFromInputs(), L2NormalizationLayer::ValidateTensorShapesFromInputs(), DebugLayer::ValidateTensorShapesFromInputs(), CastLayer::ValidateTensorShapesFromInputs(), MemCopyLayer::ValidateTensorShapesFromInputs(), MemImportLayer::ValidateTensorShapesFromInputs(), DequantizeLayer::ValidateTensorShapesFromInputs(), MergeLayer::ValidateTensorShapesFromInputs(), NormalizationLayer::ValidateTensorShapesFromInputs(), PermuteLayer::ValidateTensorShapesFromInputs(), Pooling2dLayer::ValidateTensorShapesFromInputs(), Pooling3dLayer::ValidateTensorShapesFromInputs(), FakeQuantizationLayer::ValidateTensorShapesFromInputs(), ConvertFp16ToFp32Layer::ValidateTensorShapesFromInputs(), ResizeLayer::ValidateTensorShapesFromInputs(), FloorLayer::ValidateTensorShapesFromInputs(), AbsLayer::ValidateTensorShapesFromInputs(), SliceLayer::ValidateTensorShapesFromInputs(), SoftmaxLayer::ValidateTensorShapesFromInputs(), InstanceNormalizationLayer::ValidateTensorShapesFromInputs(), StackLayer::ValidateTensorShapesFromInputs(), SwitchLayer::ValidateTensorShapesFromInputs(), LogSoftmaxLayer::ValidateTensorShapesFromInputs(), MeanLayer::ValidateTensorShapesFromInputs(), PadLayer::ValidateTensorShapesFromInputs(), ReshapeLayer::ValidateTensorShapesFromInputs(), Convolution3dLayer::ValidateTensorShapesFromInputs(), FullyConnectedLayer::ValidateTensorShapesFromInputs(), DepthwiseConvolution2dLayer::ValidateTensorShapesFromInputs(), Convolution2dLayer::ValidateTensorShapesFromInputs(), GatherNdLayer::ValidateTensorShapesFromInputs(), BatchMatMulLayer::ValidateTensorShapesFromInputs(), ElementwiseBinaryLayer::ValidateTensorShapesFromInputs(), DetectionPostProcessLayer::ValidateTensorShapesFromInputs(), ReduceLayer::ValidateTensorShapesFromInputs(), ArgMinMaxLayer::ValidateTensorShapesFromInputs(), StridedSliceLayer::ValidateTensorShapesFromInputs(), ElementwiseUnaryLayer::ValidateTensorShapesFromInputs(), GatherLayer::ValidateTensorShapesFromInputs(), DepthToSpaceLayer::ValidateTensorShapesFromInputs(), SpaceToDepthLayer::ValidateTensorShapesFromInputs(), SpaceToBatchNdLayer::ValidateTensorShapesFromInputs(), PreluLayer::ValidateTensorShapesFromInputs(), TransposeConvolution2dLayer::ValidateTensorShapesFromInputs(), ComparisonLayer::ValidateTensorShapesFromInputs(), LogicalBinaryLayer::ValidateTensorShapesFromInputs(), SplitterLayer::ValidateTensorShapesFromInputs(), LstmLayer::ValidateTensorShapesFromInputs(), UnidirectionalSequenceLstmLayer::ValidateTensorShapesFromInputs(), ConcatLayer::ValidateTensorShapesFromInputs(), BatchNormalizationLayer::ValidateTensorShapesFromInputs(), QuantizedLstmLayer::ValidateTensorShapesFromInputs(), and QLstmLayer::ValidateTensorShapesFromInputs().


The documentation for this class was generated from the following files:
armnn::Dimensionality::Specified
@ Specified
armnn::Dimensionality::NotSpecified
@ NotSpecified
armnn::Layer::GetNumOutputSlots
unsigned int GetNumOutputSlots() const override
Returns the number of connectable output slots.
Definition: Layer.hpp:322
armnn::StringifyLayerParameters::Serialize
static void Serialize(ParameterStringifyFunction &, const LayerParameter &)
Definition: SerializeLayerParameters.hpp:25
CHECK_LOCATION
#define CHECK_LOCATION()
Definition: Exceptions.hpp:203
armnn::LayerType::Input
@ Input
armnn::ITensorHandleFactory::LegacyFactoryId
static const FactoryId LegacyFactoryId
Definition: ITensorHandleFactory.hpp:50
armnn::ShapeInferenceMethod::ValidateOnly
@ ValidateOnly
Validate all output shapes.
armnn::InputSlot::GetConnection
const IOutputSlot * GetConnection() const override
Definition: Layer.hpp:206
armnn::OutputSlot::SetTensorInfo
void SetTensorInfo(const TensorInfo &tensorInfo) override
Definition: Layer.cpp:87
armnn::IgnoreUnused
void IgnoreUnused(Ts &&...)
Definition: IgnoreUnused.hpp:14
armnn::IConnectableLayer::ConstantTensors
std::vector< std::reference_wrapper< std::shared_ptr< ConstTensorHandle > >> ConstantTensors
Definition: INetwork.hpp:124
armnn::LayerPriority
unsigned int LayerPriority
Definition: Layer.hpp:214
armnn::Layer::GetConstantTensorsByRef
virtual ConstantTensors GetConstantTensorsByRef() override final
Definition: Layer.cpp:541
armnn::Layer::m_ShapeInferenceMethod
ShapeInferenceMethod m_ShapeInferenceMethod
Definition: Layer.hpp:427
armnn::OutputSlot::GetTensorInfo
const TensorInfo & GetTensorInfo() const override
Definition: Layer.cpp:92
armnn::Layer::CollectQueueDescriptorInputs
void CollectQueueDescriptorInputs(QueueDescriptor &descriptor, WorkloadInfo &info) const
Definition: Layer.hpp:373
armnn::Layer::GetNameStr
const std::string & GetNameStr() const
Definition: Layer.hpp:227
armnn::LayerType
LayerType
When adding a new layer, adapt also the LastLayer enum value in the enum class LayerType below.
Definition: Types.hpp:479
armnn::Layer::GetNumInputSlots
unsigned int GetNumInputSlots() const override
Returns the number of connectable input slots.
Definition: Layer.hpp:321
armnn::IOutputSlot::GetTensorInfo
virtual const TensorInfo & GetTensorInfo() const =0
armnn::Layer::GetOutputSlot
const OutputSlot & GetOutputSlot(unsigned int index=0) const override
Get the const output slot handle by slot index.
Definition: Layer.hpp:326
armnn::Layer::m_AdditionalInfoObject
AdditionalInfoObjectPtr m_AdditionalInfoObject
Definition: Layer.hpp:413
armnn::DataLayout::NCHW
@ NCHW
armnn::Layer::CollectQueueDescriptorOutputs
void CollectQueueDescriptorOutputs(QueueDescriptor &descriptor, WorkloadInfo &info) const
Definition: Layer.hpp:380
armnn::Layer::GetOutputHandler
const OutputHandler & GetOutputHandler(unsigned int i=0) const
Definition: Layer.hpp:232
armnn::Layer::GetType
LayerType GetType() const override
Returns the armnn::LayerType of this layer.
Definition: Layer.hpp:273
armnn::Layer::GetOutputSlots
const std::vector< OutputSlot > & GetOutputSlots() const
Definition: Layer.hpp:246
armnn::TensorInfo
Definition: Tensor.hpp:152
armnn::Layer::Layer
Layer(unsigned int numInputSlots, unsigned int numOutputSlots, LayerType type, const char *name)
Definition: Layer.cpp:247
armnnUtils::SqueezeDims
std::vector< unsigned int > SqueezeDims(const armnn::TensorShape &tensorShape)
Definition: TensorUtils.cpp:193
armnn::Layer::GetBackendId
const BackendId & GetBackendId() const
Definition: Layer.hpp:277
armnn::Layer::m_OutputHandlers
std::vector< OutputHandler > m_OutputHandlers
Definition: Layer.hpp:426
armnn::Layer::GetInputSlots
const std::vector< InputSlot > & GetInputSlots() const
Definition: Layer.hpp:245
armnn::Layer::GetInputSlot
const InputSlot & GetInputSlot(unsigned int index) const override
Get a const input slot handle by slot index.
Definition: Layer.hpp:324
armnn::Layer::GetGuid
LayerGuid GetGuid() const final
Returns the unique id of the layer.
Definition: Layer.hpp:330
armnn::Layer::GetBackendHint
Optional< BackendId > GetBackendHint() const
Definition: Layer.hpp:342
ARMNN_ASSERT
#define ARMNN_ASSERT(COND)
Definition: Assert.hpp:14
armnn::Layer::OperateOnConstantTensors
void OperateOnConstantTensors(Op op)
Definition: Layer.hpp:306
armnn::Layer::GetName
const char * GetName() const override
Returns the name of the layer.
Definition: Layer.hpp:319
armnn::ITensorHandleFactory::FactoryId
std::string FactoryId
Definition: ITensorHandleFactory.hpp:49
armnn::LayerType::Output
@ Output
armnn::IConnectableLayer::ImmutableConstantTensors
std::vector< std::reference_wrapper< const std::shared_ptr< ConstTensorHandle > >> ImmutableConstantTensors
Definition: INetwork.hpp:129
armnn::TensorInfo::GetDataType
DataType GetDataType() const
Definition: Tensor.hpp:198
armnn::GetLayerTypeAsCString
const char * GetLayerTypeAsCString(LayerType type)
Definition: InternalTypes.cpp:13
armnn::BoostLogSeverityMapping::info
@ info