ArmNN
 25.11
Loading...
Searching...
No Matches
Layer Class Referenceabstract

#include <Layer.hpp>

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

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.
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.
DataType GetDataType () const
const BackendIdGetBackendId () const
void SetBackendId (const BackendId &id) override
 Set the backend of the IConnectableLayer.
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.
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)
virtual void SerializeLayerParameters (ParameterStringifyFunction &fn) const
 Helper to serialize the layer parameters to string.
virtual void ReleaseConstantData ()
template<typename Op>
void OperateOnConstantTensors (Op op)
const char * GetName () const override
 Returns the name of the layer.
unsigned int GetNumInputSlots () const override
 Returns the number of connectable input slots.
unsigned int GetNumOutputSlots () const override
 Returns the number of connectable output slots.
const InputSlotGetInputSlot (unsigned int index) const override
 Get a const input slot handle by slot index.
InputSlotGetInputSlot (unsigned int index) override
 Get the input slot handle by slot index.
const OutputSlotGetOutputSlot (unsigned int index=0) const override
 Get the const output slot handle by slot index.
OutputSlotGetOutputSlot (unsigned int index=0) override
 Get the output slot handle by slot index.
void SetGuid (LayerGuid guid)
LayerGuid GetGuid () const final
 Returns the unique id of the layer.
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.
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.

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 *LayerCreateWorkload.
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.

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 230 of file Layer.hpp.

Constructor & Destructor Documentation

◆ Layer() [1/2]

◆ Layer() [2/2]

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

Definition at line 233 of file Layer.cpp.

238: m_OutputHandlers(numOutputSlots)
239, m_ShapeInferenceMethod(ShapeInferenceMethod::ValidateOnly)
240, m_LayerName(name ? name : "")
241, m_Type(type)
242, m_BackendId()
243, m_BackendHint(EmptyOptional())
244, m_Guid(arm::pipe::IProfilingService::GetNextGuid())
245{
246 IgnoreUnused(layout);
247 m_InputSlots.reserve(numInputSlots);
248 for (unsigned int i = 0; i < numInputSlots; ++i)
249 {
250 m_InputSlots.emplace_back(*this, i);
251 }
252
253 m_OutputSlots.reserve(numOutputSlots);
254 for (unsigned int i = 0; i < numOutputSlots; ++i)
255 {
256 m_OutputSlots.emplace_back(*this, m_OutputHandlers[i]);
257 }
258}
void IgnoreUnused(Ts &&...)

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

◆ ~Layer()

virtual ~Layer ( )
protectedvirtualdefault

Member Function Documentation

◆ AddRelatedLayerName()

void AddRelatedLayerName ( const std::string layerName)
inline

Definition at line 345 of file Layer.hpp.

345{ 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 351 of file Layer.hpp.

352 {
353 m_BackendHint = backend;
354 }

◆ BeginInputSlots()

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

◆ BeginOutputSlots()

◆ Clone()

virtual Layer * Clone ( Graph & graph) const
pure virtual

Creates a dynamically-allocated copy of this layer.

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

Implemented in AbsLayer, ActivationLayer, AdditionLayer, ArgMinMaxLayer, BatchMatMulLayer, BatchNormalizationLayer, BatchToSpaceNdLayer, BroadcastToLayer, CastLayer, ChannelShuffleLayer, ComparisonLayer, ConcatLayer, ConstantLayer, ConvertFp16ToFp32Layer, ConvertFp32ToFp16Layer, Convolution2dLayer, Convolution3dLayer, DebugLayer, DepthToSpaceLayer, DepthwiseConvolution2dLayer, DequantizeLayer, DetectionPostProcessLayer, DivisionLayer, ElementwiseBinaryLayer, ElementwiseUnaryLayer, FakeQuantizationLayer, FillLayer, FloorLayer, FullyConnectedLayer, FusedLayer, GatherLayer, GatherNdLayer, InputLayer, InstanceNormalizationLayer, L2NormalizationLayer, LogicalBinaryLayer, LogSoftmaxLayer, LstmLayer, MapLayer, MaximumLayer, MeanLayer, MemCopyLayer, MemImportLayer, MergeLayer, MinimumLayer, MultiplicationLayer, NormalizationLayer, OutputLayer, PadLayer, PermuteLayer, Pooling2dLayer, Pooling3dLayer, PreCompiledLayer, PreluLayer, QLstmLayer, QuantizedLstmLayer, QuantizeLayer, RankLayer, ReduceLayer, ReshapeLayer, ResizeLayer, ReverseV2Layer, RsqrtLayer, ScatterNdLayer, ShapeLayer, SliceLayer, SoftmaxLayer, SpaceToBatchNdLayer, SpaceToDepthLayer, SplitterLayer, StackLayer, StandInLayer, StridedSliceLayer, SubtractionLayer, SwitchLayer, TileLayer, TransposeConvolution2dLayer, TransposeLayer, UnidirectionalSequenceLstmLayer, and UnmapLayer.

References Graph, and Layer().

Referenced by SubgraphView::GetWorkingCopy().

◆ CloneBase()

template<typename LayerType, typename ... Params>
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}
const char * GetBackendId()
LayerType
When adding a new layer, adapt also the LastLayer enum value in the enum class LayerType below.
Definition Types.hpp:494

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

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

◆ CollectQueueDescriptorInputs()

template<typename QueueDescriptor>
void CollectQueueDescriptorInputs ( QueueDescriptor & descriptor,
WorkloadInfo & info ) const
inlineprotected

Definition at line 386 of file Layer.hpp.

387 {
388 WorkloadDataCollector dataCollector(descriptor.m_Inputs, info.m_InputTensorInfos);
389 CollectWorkloadInputs(dataCollector);
390 }

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

Referenced by PrepInfoAndDesc().

◆ CollectQueueDescriptorOutputs()

template<typename QueueDescriptor>
void CollectQueueDescriptorOutputs ( QueueDescriptor & descriptor,
WorkloadInfo & info ) const
inlineprotected

Definition at line 393 of file Layer.hpp.

394 {
395 WorkloadDataCollector dataCollector(descriptor.m_Outputs, info.m_OutputTensorInfos);
396 CollectWorkloadOutputs(dataCollector);
397 }

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

Referenced by PrepInfoAndDesc().

◆ CreateTensorHandles()

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

Reimplemented in ConcatLayer, OutputLayer, and SplitterLayer.

Definition at line 308 of file Layer.cpp.

311{
312 for (unsigned int idx=0; idx < GetNumOutputSlots(); idx++)
313 {
314
315 OutputSlot& slot = GetOutputSlot(idx);
316 ITensorHandleFactory::FactoryId factoryId = slot.GetTensorHandleFactoryId();
317
318 OutputHandler& handler = GetOutputHandler(idx);
319 if (factoryId == ITensorHandleFactory::LegacyFactoryId)
320 {
321 handler.CreateTensorHandles(workloadFactory, IsMemoryManaged);
322 }
323 else
324 {
325 ITensorHandleFactory* handleFactory;
326 handleFactory = registry.GetFactory(factoryId);
327 if (!handleFactory)
328 {
329 throw armnn::NullPointerException("handleFactory must not be null.");
330 }
331 handler.CreateTensorHandles(*handleFactory, IsMemoryManaged);
332 }
333 }
334}

References OutputHandler::CreateTensorHandles(), TensorHandleFactoryRegistry::GetFactory(), GetNumOutputSlots(), GetOutputHandler(), 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 LayerWithParameters< Parameters >, LayerWithParameters< ActivationDescriptor >, LayerWithParameters< ArgMinMaxDescriptor >, LayerWithParameters< BatchMatMulDescriptor >, LayerWithParameters< BatchNormalizationDescriptor >, LayerWithParameters< BatchToSpaceNdDescriptor >, LayerWithParameters< BroadcastToDescriptor >, 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< FusedDescriptor >, 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< ScatterNdDescriptor >, LayerWithParameters< SliceDescriptor >, LayerWithParameters< SoftmaxDescriptor >, LayerWithParameters< SpaceToBatchNdDescriptor >, LayerWithParameters< SpaceToDepthDescriptor >, LayerWithParameters< StackDescriptor >, LayerWithParameters< StandInDescriptor >, LayerWithParameters< StridedSliceDescriptor >, LayerWithParameters< TileDescriptor >, LayerWithParameters< TransposeConvolution2dDescriptor >, LayerWithParameters< TransposeDescriptor >, LayerWithParameters< ViewsDescriptor >, LogicalBinaryLayer, LogSoftmaxLayer, LstmLayer, MapLayer, MaximumLayer, MeanLayer, MemCopyLayer, MemImportLayer, MergeLayer, MinimumLayer, MultiplicationLayer, NormalizationLayer, OutputLayer, PadLayer, PermuteLayer, Pooling2dLayer, Pooling3dLayer, PreCompiledLayer, PreluLayer, QLstmLayer, QuantizedLstmLayer, QuantizeLayer, RankLayer, ReduceLayer, ReshapeLayer, ResizeLayer, ReverseV2Layer, RsqrtLayer, ShapeLayer, SliceLayer, SoftmaxLayer, SpaceToBatchNdLayer, SpaceToDepthLayer, SplitterLayer, StackLayer, StandInLayer, StridedSliceLayer, SubtractionLayer, SwitchLayer, TransposeConvolution2dLayer, TransposeLayer, UnidirectionalSequenceLstmLayer, and UnmapLayer.

Definition at line 571 of file Layer.cpp.

572{
573 strategy.ExecuteStrategy(this, BaseDescriptor(), {}, GetName());
574}

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

Referenced by armnn::IsNCHW().

◆ GetAdditionalInformation()

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

Definition at line 368 of file Layer.hpp.

369 {
370 return std::static_pointer_cast<T>(m_AdditionalInfoObject);
371 }

References m_AdditionalInfoObject.

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

◆ GetAllowExpandedDims()

bool GetAllowExpandedDims ( ) const
inline

Definition at line 256 of file Layer.hpp.

256{ return m_AllowExpandedDims; };

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

◆ GetBackendHint()

Optional< BackendId > GetBackendHint ( ) const
inline

Definition at line 355 of file Layer.hpp.

355{ return m_BackendHint; }

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

◆ GetBackendId()

◆ GetConstantTensorsByRef() [1/2]

virtual ImmutableConstantTensors GetConstantTensorsByRef ( ) const
inlineoverrideprotectedvirtual

◆ GetConstantTensorsByRef() [2/2]

Layer::ConstantTensors GetConstantTensorsByRef ( )
finaloverrideprotectedvirtual

Implements IConnectableLayer.

Definition at line 576 of file Layer.cpp.

577{
578 const Layer *constThis = const_cast<const Layer*>(this);
579 ConstantTensors res;
580
581 ImmutableConstantTensors immutableData = constThis->GetConstantTensorsByRef();
582 for (auto i : immutableData)
583 {
584 res.push_back(const_cast<std::shared_ptr<ConstTensorHandle>&>(i.get()));
585 }
586 return res;
587}

References GetConstantTensorsByRef(), and Layer().

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

◆ GetDataType()

DataType GetDataType ( ) const

Definition at line 345 of file Layer.cpp.

346{
347 if (GetNumInputSlots() > 0) // Ignore the input layer.
348 {
349 return GetInputSlot(0).GetTensorInfo().GetDataType();
350 }
351 return GetOutputSlot(0).GetTensorInfo().GetDataType();
352}

References TensorInfo::GetDataType(), GetInputSlot(), GetNumInputSlots(), GetOutputSlot(), InputSlot::GetTensorInfo(), and OutputSlot::GetTensorInfo().

Referenced by ConvertConstPermuteLayersToConstLayers::Run(), ConvertFp32NetworkToFp16Impl::Run(), FuseBatchNorm< ConvLayer, ArmnnType, T >::Run(), IsFloat16Layer::Test(), and IsFloat32Layer::Test().

◆ GetGuid()

◆ GetInputSlot() [1/2]

const InputSlot & GetInputSlot ( unsigned int index) const
inlineoverridevirtual

Get a const input slot handle by slot index.

Implements IConnectableLayer.

Examples
SimpleSample.cpp.

Definition at line 337 of file Layer.hpp.

337{ return m_InputSlots.at(index); }

Referenced by Graph::AddCompatibilityLayers(), armnn::ApplyBackendOptimizations(), armnn::BuildAddMulAddTensorInfoLists(), armnn::ChainReduceLayers(), armnn::ConnectedToLayerType(), armnn::ConnectedToLayerWithNCHW(), ConvertAvgPool2DIgnoreValueToTosaOperator(), ConvertBatchMatMulToTosaOperator(), ConvertBatchToSpaceToTosaOperator(), ConvertConcatToTosaOperator(), ConvertConstantToTosaOperator(), ConvertConv2dToTosaOperator(), ConvertConv3dToTosaOperator(), ConvertDepthToSpaceToTosaOperator(), ConvertDepthwiseConv2dToTosaOperator(), ConvertDequantizeToTosaOperator(), ConvertElementwiseBinaryToTosaOperator(), ConvertExpOperator(), ConvertFullyConnectedToTosaOperator(), ConvertGatherToTosaOperator(), ConvertGeluToTosaOperator(), ConvertHardSwishToTosaOperator(), ConvertLeakyReluToTosaOperator(), ConvertLogOperator(), ConvertPadToTosaOperator(), ConvertPooling2DToTosaOperator(), ConvertPReluToTosaOperator(), ConvertQuantizeToTosaOperator(), ConvertReduceToTosaOperator(), ConvertReluToTosaOperator(), ConvertReshapeToTosaOperator(), ConvertResizeToTosaOperator(), ConvertRsqrtOperator(), ConvertSigmoidToTosaOperator(), ConvertSliceToTosaOperator(), ConvertSoftmaxToTosaOperator(), ConvertSpaceToBatchToTosaOperator(), ConvertSplitToTosaOperator(), ConvertSquaredDifferenceToTosaOperator(), ConvertStackToTosaOperator(), ConvertStridedSliceToTosaOperator(), ConvertTanHToTosaOperator(), ConvertTransposeConv2dToTosaOperator(), ConvertTransposeToTosaOperator(), DebugLayer::CreateWorkload(), armnn::optimizations::pad_fold::FoldPadIntoLayer2dImpl(), LayerWithParameters< Parameters >::GetConnectedConstantAsInputTensors(), GetDataType(), armnn::GetLayerInOutDatatype(), InputSlot::Insert(), armnn::InsertConvertFp16ToFp32LayersBefore(), armnn::InsertConvertFp32ToFp16LayersAfter(), armnn::InsertDebugLayerAfter(), ClBackend::OptimizeSubgraphView(), NeonBackend::OptimizeSubgraphView(), RefBackend::OptimizeSubgraphView(), armnn::RemoveReshapeLayer(), AddBroadcastReshapeLayerImpl::Run(), FuseBatchNorm< ConvLayer, ArmnnType, T >::Run(), MovePermuteUpImpl::Run(), MoveTransposeUpImpl::Run(), OptimizeConsecutiveReshapesImpl::Run(), OptimizeInverseConversionsImpl::Run(), OptimizeInversePermutesImpl< PermuteType >::Run(), PermuteAndBatchToSpaceAsDepthToSpaceImpl< PermuteType >::Run(), PermuteAsReshapeImpl::Run(), TransposeAsReshapeImpl::Run(), Convolution2dLayer::SerializeLayerParameters(), Convolution3dLayer::SerializeLayerParameters(), DepthwiseConvolution2dLayer::SerializeLayerParameters(), AbsLayer::ValidateTensorShapesFromInputs(), ActivationLayer::ValidateTensorShapesFromInputs(), ArgMinMaxLayer::ValidateTensorShapesFromInputs(), BatchMatMulLayer::ValidateTensorShapesFromInputs(), BatchNormalizationLayer::ValidateTensorShapesFromInputs(), BatchToSpaceNdLayer::ValidateTensorShapesFromInputs(), CastLayer::ValidateTensorShapesFromInputs(), ChannelShuffleLayer::ValidateTensorShapesFromInputs(), ComparisonLayer::ValidateTensorShapesFromInputs(), ConcatLayer::ValidateTensorShapesFromInputs(), ConvertFp16ToFp32Layer::ValidateTensorShapesFromInputs(), ConvertFp32ToFp16Layer::ValidateTensorShapesFromInputs(), Convolution2dLayer::ValidateTensorShapesFromInputs(), Convolution3dLayer::ValidateTensorShapesFromInputs(), DebugLayer::ValidateTensorShapesFromInputs(), DepthToSpaceLayer::ValidateTensorShapesFromInputs(), DepthwiseConvolution2dLayer::ValidateTensorShapesFromInputs(), DequantizeLayer::ValidateTensorShapesFromInputs(), DetectionPostProcessLayer::ValidateTensorShapesFromInputs(), ElementwiseBaseLayer::ValidateTensorShapesFromInputs(), ElementwiseBinaryLayer::ValidateTensorShapesFromInputs(), ElementwiseUnaryLayer::ValidateTensorShapesFromInputs(), FakeQuantizationLayer::ValidateTensorShapesFromInputs(), FillLayer::ValidateTensorShapesFromInputs(), FloorLayer::ValidateTensorShapesFromInputs(), FullyConnectedLayer::ValidateTensorShapesFromInputs(), GatherLayer::ValidateTensorShapesFromInputs(), GatherNdLayer::ValidateTensorShapesFromInputs(), InstanceNormalizationLayer::ValidateTensorShapesFromInputs(), L2NormalizationLayer::ValidateTensorShapesFromInputs(), LogicalBinaryLayer::ValidateTensorShapesFromInputs(), LogSoftmaxLayer::ValidateTensorShapesFromInputs(), LstmLayer::ValidateTensorShapesFromInputs(), MeanLayer::ValidateTensorShapesFromInputs(), MemCopyLayer::ValidateTensorShapesFromInputs(), MemImportLayer::ValidateTensorShapesFromInputs(), MergeLayer::ValidateTensorShapesFromInputs(), NormalizationLayer::ValidateTensorShapesFromInputs(), OutputLayer::ValidateTensorShapesFromInputs(), PadLayer::ValidateTensorShapesFromInputs(), PermuteLayer::ValidateTensorShapesFromInputs(), Pooling2dLayer::ValidateTensorShapesFromInputs(), Pooling3dLayer::ValidateTensorShapesFromInputs(), PreluLayer::ValidateTensorShapesFromInputs(), QLstmLayer::ValidateTensorShapesFromInputs(), QuantizedLstmLayer::ValidateTensorShapesFromInputs(), QuantizeLayer::ValidateTensorShapesFromInputs(), ReduceLayer::ValidateTensorShapesFromInputs(), ReshapeLayer::ValidateTensorShapesFromInputs(), ResizeLayer::ValidateTensorShapesFromInputs(), ReverseV2Layer::ValidateTensorShapesFromInputs(), RsqrtLayer::ValidateTensorShapesFromInputs(), ScatterNdLayer::ValidateTensorShapesFromInputs(), ShapeLayer::ValidateTensorShapesFromInputs(), SliceLayer::ValidateTensorShapesFromInputs(), SoftmaxLayer::ValidateTensorShapesFromInputs(), SpaceToBatchNdLayer::ValidateTensorShapesFromInputs(), SpaceToDepthLayer::ValidateTensorShapesFromInputs(), StackLayer::ValidateTensorShapesFromInputs(), StridedSliceLayer::ValidateTensorShapesFromInputs(), SwitchLayer::ValidateTensorShapesFromInputs(), TileLayer::ValidateTensorShapesFromInputs(), TransposeConvolution2dLayer::ValidateTensorShapesFromInputs(), TransposeLayer::ValidateTensorShapesFromInputs(), UnidirectionalSequenceLstmLayer::ValidateTensorShapesFromInputs(), VerifyLayerConnections(), ConvertConstDequantisationLayersToConstLayersImpl::~ConvertConstDequantisationLayersToConstLayersImpl(), PermuteDepthwiseConv2dWeightsImpl::~PermuteDepthwiseConv2dWeightsImpl(), and TurboConvertConstDequantisationLayersToConstLayersImpl::~TurboConvertConstDequantisationLayersToConstLayersImpl().

◆ GetInputSlot() [2/2]

InputSlot & GetInputSlot ( unsigned int index)
inlineoverridevirtual

Get the input slot handle by slot index.

Implements IConnectableLayer.

Definition at line 338 of file Layer.hpp.

338{ return m_InputSlots.at(index); }

◆ GetInputSlots()

◆ GetName()

const char * GetName ( ) const
inlineoverridevirtual

Returns the name of the layer.

Implements IConnectableLayer.

Definition at line 332 of file Layer.hpp.

332{ return m_LayerName.c_str(); }

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

251 {
252 return const_cast<OutputHandler&>(const_cast<const Layer*>(this)->GetOutputHandler(i));
253 }

References Layer().

◆ 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
SimpleSample.cpp.

Definition at line 339 of file Layer.hpp.

339{ return m_OutputSlots.at(index); }

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

◆ GetOutputSlot() [2/2]

OutputSlot & GetOutputSlot ( unsigned int index = 0)
inlineoverridevirtual

Get the output slot handle by slot index.

Implements IConnectableLayer.

Definition at line 340 of file Layer.hpp.

340{ return m_OutputSlots.at(index); }

◆ GetOutputSlots()

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

Definition at line 259 of file Layer.hpp.

259{ return m_OutputSlots; }

Referenced by Graph::AddCompatibilityLayers(), armnn::ForEachLayerOutput(), GetTosaMappingFromLayer(), IsOutputUnconnected(), and Graph::Print().

◆ GetParameters()

virtual const BaseDescriptor & GetParameters ( ) const
inlineoverridevirtual

If the layer has a descriptor return it.

The base descriptor can then be cast to the correct descriptor class. If the layer has no associated descriptor a struct of type NullDescriptor will be returned. Note: NullDescriptors can be detected because they return true when the BaseDescriptor IsNull function is invoked.

Implements IConnectableLayer.

Reimplemented in LayerWithParameters< Parameters >, LayerWithParameters< ActivationDescriptor >, LayerWithParameters< ArgMinMaxDescriptor >, LayerWithParameters< BatchMatMulDescriptor >, LayerWithParameters< BatchNormalizationDescriptor >, LayerWithParameters< BatchToSpaceNdDescriptor >, LayerWithParameters< BroadcastToDescriptor >, 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< FusedDescriptor >, 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< ScatterNdDescriptor >, LayerWithParameters< SliceDescriptor >, LayerWithParameters< SoftmaxDescriptor >, LayerWithParameters< SpaceToBatchNdDescriptor >, LayerWithParameters< SpaceToDepthDescriptor >, LayerWithParameters< StackDescriptor >, LayerWithParameters< StandInDescriptor >, LayerWithParameters< StridedSliceDescriptor >, LayerWithParameters< TileDescriptor >, LayerWithParameters< TransposeConvolution2dDescriptor >, LayerWithParameters< TransposeDescriptor >, and LayerWithParameters< ViewsDescriptor >.

Definition at line 378 of file Layer.hpp.

378{ return m_NullDescriptor; }

Referenced by AbsLayer::ExecuteStrategy(), AdditionLayer::ExecuteStrategy(), ConvertFp16ToFp32Layer::ExecuteStrategy(), ConvertFp32ToFp16Layer::ExecuteStrategy(), DebugLayer::ExecuteStrategy(), DequantizeLayer::ExecuteStrategy(), DivisionLayer::ExecuteStrategy(), FloorLayer::ExecuteStrategy(), InputLayer::ExecuteStrategy(), MaximumLayer::ExecuteStrategy(), MemCopyLayer::ExecuteStrategy(), MergeLayer::ExecuteStrategy(), MinimumLayer::ExecuteStrategy(), MultiplicationLayer::ExecuteStrategy(), OutputLayer::ExecuteStrategy(), PreluLayer::ExecuteStrategy(), QuantizeLayer::ExecuteStrategy(), RsqrtLayer::ExecuteStrategy(), SubtractionLayer::ExecuteStrategy(), SwitchLayer::ExecuteStrategy(), GetTosaMappingFromLayer(), MovePermuteUpImpl::~MovePermuteUpImpl(), and MoveTransposeUpImpl::~MoveTransposeUpImpl().

◆ GetPriority()

LayerPriority GetPriority ( ) const

Definition at line 360 of file Layer.cpp.

361{
362 constexpr LayerPriority inputPrio = std::numeric_limits<LayerPriority>::lowest();
363 constexpr LayerPriority outputPrio = std::numeric_limits<LayerPriority>::max();
364
365 if (GetType() == LayerType::Input)
366 {
367 m_Priority = inputPrio;
368 }
369 else if (GetType() == LayerType::Output)
370 {
371 m_Priority = outputPrio;
372 }
373 else if (m_Priority == 0)
374 {
375 if (m_Visiting)
376 {
377 throw GraphValidationException("Graph has circular dependencies: cannot walk");
378 }
379
380 auto maxPrio = [](const LayerPriority prio, const InputSlot& slot) -> LayerPriority
381 {
382 const OutputSlot *outputSlot = slot.GetConnectedOutputSlot();
383 if (outputSlot)
384 {
385 const Layer& input = outputSlot->GetOwningLayer();
386 return std::max(prio, input.GetPriority());
387 }
388 else
389 {
390 // unconnected input slot
391 return prio;
392 }
393 };
394
395 m_Visiting = true;
396 LayerPriority parentPrio = std::accumulate(GetInputSlots().cbegin(), GetInputSlots().cend(), 0U, maxPrio);
397 m_Visiting = false;
398
399 if (parentPrio >= outputPrio)
400 {
401 throw GraphValidationException("Graph has too many edges");
402 }
403
404 m_Priority = parentPrio + 1U;
405 }
406
407 return m_Priority;
408}
unsigned int LayerPriority
Definition Layer.hpp:227

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

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

◆ GetRelatedLayerNames()

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

Definition at line 347 of file Layer.hpp.

347{ return m_RelatedLayerNames; }

Referenced by ErasedLayerNamesObservable::Update().

◆ GetShapeInferenceMethod()

ShapeInferenceMethod GetShapeInferenceMethod ( ) const
inline

Definition at line 255 of file Layer.hpp.

255{ return m_ShapeInferenceMethod; };

References m_ShapeInferenceMethod.

◆ GetType()

LayerType GetType ( ) const
inlineoverridevirtual

Returns the armnn::LayerType of this layer.

Implements IConnectableLayer.

Definition at line 286 of file Layer.hpp.

286{ return m_Type; }

Referenced by armnn::ApplyBackendOptimizations(), armnn::AssertNumberOfInputSlots(), armnn::AttemptBackendAssignment(), armnn::BuildAddMulAddTensorInfoLists(), armnn::CalculateEdgeStrategy(), armnn::CalculateSlotOption(), armnn::CalculateSlotOptionForInput(), armnn::CheckScaleSetOnQuantizedType(), armnn::ConnectedToLayerType(), ConvertSquaredDifferenceToTosaOperator(), GenerateUniqueOutputName(), GetPriority(), GetTosaMapping(), GetTosaMappingFromLayer(), InferOutputShapes(), PermuteLayer::IsEqual(), ReshapeLayer::IsEqual(), TransposeLayer::IsEqual(), PermuteLayer::IsInverse(), TransposeLayer::IsInverse(), IsLayerOfType(), armnn::IsLayerSupported(), armnn::IsSequenceLayerType(), armnn::IsSequenceLayerType(), LayerNameAndTypeCheck::operator()(), ClBackend::OptimizeSubgraphView(), NeonBackend::OptimizeSubgraphView(), RefBackend::OptimizeSubgraphView(), TosaRefBackend::OptimizeSubgraphView(), armnn::RemoveReshapeLayer(), armnn::ReturnWithError(), AddBroadcastReshapeLayerImpl::Run(), AddDebugImpl::Run(), AddDebugToFileImpl::Run(), ConvertConstDequantisationLayersToConstLayersImpl::Run(), ConvertConstPermuteLayersToConstLayers::Run(), ConvertFp32NetworkToFp16Impl::Run(), DeleteBroadcastToImpl::Run(), FuseBatchNorm< ConvLayer, ArmnnType, T >::Run(), OptimizeConsecutiveReshapesImpl::Run(), OptimizeInverseConversionsImpl::Run(), PermuteAndBatchToSpaceAsDepthToSpaceImpl< PermuteType >::Run(), PermuteDepthwiseConv2dWeightsImpl::Run(), TurboConvertConstDequantisationLayersToConstLayersImpl::Run(), OptimizeForTypeImpl< BaseType, Wrapped >::Run(), armnn::SelectTensorHandleStrategy(), ElementwiseBaseLayer::ValidateTensorShapesFromInputs(), ElementwiseBinaryLayer::ValidateTensorShapesFromInputs(), ElementwiseUnaryLayer::ValidateTensorShapesFromInputs(), VerifyLayerConnections(), MovePermuteUpImpl::~MovePermuteUpImpl(), and MoveTransposeUpImpl::~MoveTransposeUpImpl().

◆ 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 LogicalBinaryLayer, LstmLayer, MeanLayer, MergeLayer, PadLayer, PermuteLayer, Pooling2dLayer, Pooling3dLayer, PreluLayer, QLstmLayer, QuantizedLstmLayer, RankLayer, ReduceLayer, ReshapeLayer, ResizeLayer, ReverseV2Layer, ScatterNdLayer, ShapeLayer, SliceLayer, SpaceToBatchNdLayer, SpaceToDepthLayer, SplitterLayer, StackLayer, StandInLayer, StridedSliceLayer, TileLayer, TransposeConvolution2dLayer, TransposeLayer, and UnidirectionalSequenceLstmLayer.

Definition at line 432 of file Layer.cpp.

433{
434 ARMNN_THROW_INVALIDARG_MSG_IF_FALSE(GetNumInputSlots() != 0, "input slots must not be zero.");
435 ARMNN_THROW_INVALIDARG_MSG_IF_FALSE(GetNumOutputSlots() != 0, "output slots must not be zero.");
436
437 // By default we return what we got, meaning the output shape(s) are the same as the input(s).
438 // This only works if the number of inputs and outputs are the same. Since we are in the Layer
439 // base class, this means the implementation needs to be overridden in the specific layers for
440 // the other cases. So the missing implementation justifies the UnimplementedException.
441
442 if (GetNumInputSlots() != GetNumOutputSlots())
443 {
444 throw UnimplementedException(
445 fmt::format("Default implementation for InferOutputShapes can only be used for "
446 "layers with the same number of input and output slots. This doesn't "
447 "hold for {0} layer {1} (#inputs={2} #outputs={3}) {4}",
448 GetLayerTypeAsCString(this->GetType()),
449 GetNameStr(),
450 GetNumInputSlots(),
451 GetNumOutputSlots(),
452 CHECK_LOCATION().AsString()));
453 }
454 return inputShapes;
455}
#define ARMNN_THROW_INVALIDARG_MSG_IF_FALSE(_cond, _str)
#define CHECK_LOCATION()
const char * GetLayerTypeAsCString(LayerType type)

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

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

◆ IsOutputUnconnected()

bool IsOutputUnconnected ( )
inline

Definition at line 270 of file Layer.hpp.

271 {
272 unsigned int numConnections = 0;
273
274 for (auto&& output : GetOutputSlots())
275 {
276 numConnections += output.GetNumConnections();
277 }
278
279 return (GetNumOutputSlots() > 0) && (numConnections == 0);
280 }

References GetNumOutputSlots(), and GetOutputSlots().

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

◆ OperateOnConstantTensors()

template<typename Op>
void OperateOnConstantTensors ( Op op)
inline

Definition at line 319 of file Layer.hpp.

320 {
321 for (auto constant : GetConstantTensorsByRef())
322 {
323 if (constant.get())
324 {
325 op(constant);
326 }
327 }
328 };

References GetConstantTensorsByRef().

Referenced by ReleaseConstantData(), and ConvertConstants< Float16ToFloat32, IsFloat32Layer >::Run().

◆ PrepInfoAndDesc()

◆ ReleaseConstantData()

void ReleaseConstantData ( )
virtual

Reimplemented in ConstantLayer, Convolution2dLayer, DepthwiseConvolution2dLayer, and FullyConnectedLayer.

Definition at line 336 of file Layer.cpp.

337{
338 // Now free up the static data.
339 OperateOnConstantTensors([](std::shared_ptr<ConstTensorHandle>& handle)
340 {
341 handle.reset();
342 });
343}

References OperateOnConstantTensors().

◆ Reparent()

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

References Graph.

Referenced by Graph::operator=().

◆ ResetPriority()

void ResetPriority ( ) const

Definition at line 354 of file Layer.cpp.

355{
356 m_Priority = 0;
357 m_Visiting = false;
358}

◆ SerializeLayerParameters()

void SerializeLayerParameters ( ParameterStringifyFunction & fn) const
virtual

Helper to serialize the layer parameters to string.

(currently used in DotSerializer and company).

Reimplemented in ConstantLayer, Convolution2dLayer, Convolution3dLayer, DepthwiseConvolution2dLayer, LayerWithParameters< Parameters >, LayerWithParameters< ActivationDescriptor >, LayerWithParameters< ArgMinMaxDescriptor >, LayerWithParameters< BatchMatMulDescriptor >, LayerWithParameters< BatchNormalizationDescriptor >, LayerWithParameters< BatchToSpaceNdDescriptor >, LayerWithParameters< BroadcastToDescriptor >, 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< FusedDescriptor >, 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< ScatterNdDescriptor >, LayerWithParameters< SliceDescriptor >, LayerWithParameters< SoftmaxDescriptor >, LayerWithParameters< SpaceToBatchNdDescriptor >, LayerWithParameters< SpaceToDepthDescriptor >, LayerWithParameters< StackDescriptor >, LayerWithParameters< StandInDescriptor >, LayerWithParameters< StridedSliceDescriptor >, LayerWithParameters< TileDescriptor >, LayerWithParameters< TransposeConvolution2dDescriptor >, LayerWithParameters< TransposeDescriptor >, and LayerWithParameters< ViewsDescriptor >.

Definition at line 540 of file Layer.cpp.

541{
542 std::string guid = std::to_string(m_Guid);
543 std::string layerType = GetLayerTypeAsCString(m_Type);
544 std::string backendId = std::string(m_BackendId);
545 if (!(guid.compare("") == 0) && !guid.empty())
546 {
547 fn("Guid", guid);
548 }
549 if(!(m_LayerName.compare("") == 0) && !m_LayerName.empty())
550 {
551 fn("LayerName",m_LayerName);
552 }
553 if(!(layerType.compare("") == 0) && !layerType.empty())
554 {
555 fn("LayerType",layerType);
556 }
557 if(!(backendId.compare("") == 0) && !backendId.empty())
558 {
559 fn("BackendID",backendId);
560 }
561 std::shared_ptr<ActivationDescriptor>
562 activationDescPtr = GetAdditionalInformation<ActivationDescriptor>();
563
564 if (activationDescPtr)
565 {
566 StringifyLayerParameters<ActivationDescriptor>::Serialize(fn, *activationDescPtr.get());
567 }
568}

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

Referenced by ConstantLayer::SerializeLayerParameters(), and LayerWithParameters< Parameters >::SerializeLayerParameters().

◆ SetAdditionalInfo()

void SetAdditionalInfo ( QueueDescriptor & descriptor) const
protected

Definition at line 303 of file Layer.cpp.

304{
305 descriptor.m_AdditionalInfoObject = m_AdditionalInfoObject.get();
306}

References m_AdditionalInfoObject, and QueueDescriptor::m_AdditionalInfoObject.

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

◆ SetAdditionalInfoForObject()

void SetAdditionalInfoForObject ( const AdditionalInfoObjectPtr & additionalInfo)
inline

Definition at line 373 of file Layer.hpp.

374 {
375 m_AdditionalInfoObject = additionalInfo;
376 }

References m_AdditionalInfoObject.

Referenced by NeonBackend::OptimizeSubgraphView().

◆ SetAllowExpandedDims()

void SetAllowExpandedDims ( bool allowExpandedDims)
inline

Definition at line 362 of file Layer.hpp.

363 {
364 m_AllowExpandedDims = allowExpandedDims;
365 }

◆ 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 291 of file Layer.hpp.

291{ m_BackendId = id; }

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

◆ SetGuid()

void SetGuid ( LayerGuid guid)
inline

Definition at line 342 of file Layer.hpp.

342{ m_Guid = guid; }

◆ SetShapeInferenceMethod()

void SetShapeInferenceMethod ( ShapeInferenceMethod shapeInferenceMethod)
inline

Definition at line 357 of file Layer.hpp.

358 {
359 m_ShapeInferenceMethod = shapeInferenceMethod;
360 }

References 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 457 of file Layer.cpp.

462{
463 if (shapeInferenceMethod == ShapeInferenceMethod::ValidateOnly)
464 {
465 if (m_AllowExpandedDims)
466 {
467 std::vector<unsigned int> outputDims = armnnUtils::SqueezeDims(outputShape);
468 std::vector<unsigned int> inferredDims = armnnUtils::SqueezeDims(inferredShape);
469
470 if (outputDims.size() != inferredDims.size())
471 {
472 std::stringstream ss;
473 ss << layerName << ": TensorShape set on OutputSlot[" << outputSlotIndex <<
474 "] does not match the inferred shape. ";
475 ss << outputShape << " != " << inferredShape;
476 throw LayerValidationException(ss.str());
477 }
478 for (unsigned int i = 0; i < outputDims.size(); ++i)
479 {
480 if (outputDims[i] != inferredDims[i])
481 {
482 std::stringstream ss;
483 ss << layerName << ": TensorShape set on OutputSlot[" << outputSlotIndex <<
484 "] does not match the inferred shape at dimension index [";
485 ss << i << "] " << outputShape << " != " << inferredShape;
486 throw LayerValidationException(ss.str());
487 }
488 }
489 return;
490 }
491 else
492 {
493 ConditionalThrowIfNotEqual<LayerValidationException>(
494 layerName + ": TensorShape set on OutputSlot[0] does not match the inferred shape.",
495 outputShape,
496 inferredShape);
497 return;
498 }
499 }
500
501 if (outputShape.GetDimensionality() == Dimensionality::Specified)
502 {
503 for (unsigned int i = 0; i < outputShape.GetNumDimensions(); ++i)
504 {
505 if (outputShape.GetDimensionSpecificity(i) && outputShape[i] != inferredShape[i])
506 {
507 std::stringstream ss;
508 ss << layerName << ": TensorShape set on OutputSlot[" << outputSlotIndex <<
509 "] does not match the inferred shape at dimension index [";
510 ss << i << "] " << outputShape << " != " << inferredShape;
511 throw LayerValidationException(ss.str());
512 }
513 }
514 }
515
516 TensorInfo info = GetOutputSlot(outputSlotIndex).GetTensorInfo();
517
518 armnn::TensorInfo inferredTensorInfo(inferredShape,
519 info.GetDataType(),
520 info.GetQuantizationScale(),
521 info.GetQuantizationOffset());
522
523 GetOutputSlot(outputSlotIndex).SetTensorInfo(inferredTensorInfo);
524}
std::vector< unsigned int > SqueezeDims(const armnn::TensorShape &tensorShape)

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

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

◆ ValidateTensorShapesFromInputs()

◆ VerifyLayerConnections()

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

Definition at line 410 of file Layer.cpp.

411{
412 if (GetNumInputSlots() != expectedConnections)
413 {
414 throw armnn::Exception("input slots must match expected connections.");
415 }
416
417 for (unsigned int i=0; i<expectedConnections; ++i)
418 {
419 if (GetInputSlot(i).GetConnection() == nullptr)
420 {
421 throw LayerValidationException(
422 fmt::format("Input connection #{0} must be connected "
423 "for {1} layer {2} {3}",
424 i,
425 GetLayerTypeAsCString(this->GetType()),
426 GetNameStr(),
427 location.AsString()));
428 }
429 }
430}
std::string AsString() const

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

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

◆ VerifyShapeInferenceType()

void VerifyShapeInferenceType ( const TensorShape & outputShape,
ShapeInferenceMethod shapeInferenceMethod )
protected

Definition at line 526 of file Layer.cpp.

527{
528 if (shapeInferenceMethod == ShapeInferenceMethod::ValidateOnly)
529 {
530 ConditionalThrow<LayerValidationException>(
531 outputShape.GetDimensionality() != Dimensionality::NotSpecified,
532 "Dimensionality can not be NotSpecified while using ShapeInferenceMethod::ValidateOnly");
533
534 ConditionalThrow<LayerValidationException>(
535 outputShape.AreAllDimensionsSpecified(),
536 "Unspecified dimension while using ShapeInferenceMethod::ValidateOnly");
537 }
538}

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

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

◆ Graph

Member Data Documentation

◆ m_AdditionalInfoObject

AdditionalInfoObjectPtr m_AdditionalInfoObject
protected

◆ m_OutputHandlers

std::vector<OutputHandler> m_OutputHandlers
protected

Definition at line 440 of file Layer.hpp.

Referenced by GetOutputHandler(), and Layer().

◆ m_ShapeInferenceMethod

ShapeInferenceMethod m_ShapeInferenceMethod
protected

Definition at line 441 of file Layer.hpp.

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


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