ArmNN
 20.11
QuantizerVisitor Class Reference

Visitor object for quantizing layers in a network. More...

#include <QuantizerVisitor.hpp>

Inheritance diagram for QuantizerVisitor:
LayerVisitorBase< VisitorThrowingPolicy > ILayerVisitor

Public Member Functions

 QuantizerVisitor (const RangeTracker &rangeTracker, const IQuantizationScheme *quantizationScheme, bool preserveType=false)
 
 ~QuantizerVisitor ()=default
 
void VisitAbsLayer (const IConnectableLayer *layer, const char *name=nullptr) override
 Functions to quantize the individual layers, overridden from ILayerVisitor. More...
 
void VisitActivationLayer (const IConnectableLayer *layer, const ActivationDescriptor &activationDescriptor, const char *name=nullptr) override
 Function that an activation layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitAdditionLayer (const IConnectableLayer *layer, const char *name=nullptr) override
 Function that an addition layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitArgMinMaxLayer (const IConnectableLayer *layer, const ArgMinMaxDescriptor &argMinMaxDescriptor, const char *name=nullptr) override
 Function that an arg min max layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitBatchNormalizationLayer (const IConnectableLayer *layer, const BatchNormalizationDescriptor &desc, const ConstTensor &mean, const ConstTensor &variance, const ConstTensor &beta, const ConstTensor &gamma, const char *name=nullptr) override
 Function that a batch normalization layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitBatchToSpaceNdLayer (const IConnectableLayer *layer, const BatchToSpaceNdDescriptor &batchToSpaceNdDescriptor, const char *name=nullptr) override
 Function that a batch to space ND layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitComparisonLayer (const IConnectableLayer *layer, const ComparisonDescriptor &comparisonDescriptor, const char *name=nullptr) override
 Function a Comparison layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitConcatLayer (const IConnectableLayer *layer, const OriginsDescriptor &originsDescriptor, const char *name=nullptr) override
 Function that a concat layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitConstantLayer (const IConnectableLayer *layer, const ConstTensor &input, const char *name=nullptr) override
 Function a layer with no inputs and a single output, which always corresponds to the passed in constant tensor should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitConvolution2dLayer (const IConnectableLayer *layer, const Convolution2dDescriptor &convolution2dDescriptor, const ConstTensor &weights, const Optional< ConstTensor > &biases, const char *name=nullptr) override
 Function that a 2D convolution layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitDepthToSpaceLayer (const IConnectableLayer *layer, const DepthToSpaceDescriptor &depthToSpaceDescriptor, const char *name=nullptr) override
 Function a depth to space layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitDepthwiseConvolution2dLayer (const IConnectableLayer *layer, const DepthwiseConvolution2dDescriptor &desc, const ConstTensor &weights, const Optional< ConstTensor > &biases, const char *name=nullptr) override
 Function that a 2D depthwise convolution layer with biases should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitElementwiseUnaryLayer (const IConnectableLayer *layer, const ElementwiseUnaryDescriptor &elementwiseUnaryDescriptor, const char *name=nullptr) override
 Function a ElementwiseUnary layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitFillLayer (const IConnectableLayer *layer, const FillDescriptor &desc, const char *name) override
 Function a fill layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitFullyConnectedLayer (const IConnectableLayer *layer, const FullyConnectedDescriptor &desc, const ConstTensor &weights, const Optional< ConstTensor > &biases, const char *name=nullptr) override
 Function that a fully connected layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitInputLayer (const IConnectableLayer *layer, LayerBindingId id, const char *name=nullptr) override
 Function that an InputLayer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitInstanceNormalizationLayer (const IConnectableLayer *layer, const InstanceNormalizationDescriptor &instanceNormalizationDescriptor, const char *name=nullptr) override
 Function that an instance normalization layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitLogSoftmaxLayer (const IConnectableLayer *layer, const LogSoftmaxDescriptor &logSoftmaxDescriptor, const char *name=nullptr) override
 Function that a log softmax layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitMeanLayer (const IConnectableLayer *layer, const MeanDescriptor &meanDescriptor, const char *name=nullptr) override
 Function a Mean layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitMultiplicationLayer (const IConnectableLayer *layer, const char *name=nullptr) override
 Function that a multiplication layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitNormalizationLayer (const IConnectableLayer *layer, const NormalizationDescriptor &normalizationDescriptor, const char *name=nullptr) override
 Function that a normalization layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitOutputLayer (const IConnectableLayer *layer, LayerBindingId id, const char *name=nullptr) override
 Function an output layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitPadLayer (const IConnectableLayer *, const PadDescriptor &, const char *name=nullptr) override
 Function a pad layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitPermuteLayer (const IConnectableLayer *layer, const PermuteDescriptor &permuteDescriptor, const char *name=nullptr) override
 Function that a permute layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitPooling2dLayer (const IConnectableLayer *layer, const Pooling2dDescriptor &pooling2dDescriptor, const char *name=nullptr) override
 Function that a pooling layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitPreluLayer (const IConnectableLayer *layer, const char *name=nullptr) override
 Function that a PReLU activation layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitReshapeLayer (const IConnectableLayer *layer, const ReshapeDescriptor &reshapeDescriptor, const char *name=nullptr) override
 Function a reshape layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitResizeLayer (const IConnectableLayer *layer, const ResizeDescriptor &resizeDescriptor, const char *name=nullptr) override
 Function that a resize layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitResizeBilinearLayer (const IConnectableLayer *layer, const ResizeBilinearDescriptor &resizeDesc, const char *name=nullptr) override
 Function that a resize bilinear layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitRsqrtLayer (const IConnectableLayer *, const char *name=nullptr) override
 Function a Reciprocal of square root layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitSliceLayer (const IConnectableLayer *layer, const SliceDescriptor &sliceDescriptor, const char *name=nullptr) override
 Function that a slice layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitSoftmaxLayer (const IConnectableLayer *layer, const SoftmaxDescriptor &softmaxDescriptor, const char *name=nullptr) override
 Function that a softmax layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitSpaceToBatchNdLayer (const IConnectableLayer *layer, const SpaceToBatchNdDescriptor &spaceToBatchNdDescriptor, const char *name=nullptr) override
 Function a space to batch layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitSpaceToDepthLayer (const IConnectableLayer *layer, const SpaceToDepthDescriptor &spaceToDepthDescriptor, const char *name=nullptr) override
 Function a space to depth layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitSplitterLayer (const IConnectableLayer *layer, const SplitterDescriptor &splitterDescriptor, const char *name=nullptr) override
 Function that a splitter layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitStackLayer (const IConnectableLayer *layer, const StackDescriptor &stackDescriptor, const char *name=nullptr) override
 Function a stack layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitStridedSliceLayer (const IConnectableLayer *layer, const StridedSliceDescriptor &stridedSliceDescriptor, const char *name=nullptr) override
 Function a strided slice layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitSubtractionLayer (const IConnectableLayer *layer, const char *name=nullptr) override
 Function a subtraction layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitTransposeConvolution2dLayer (const IConnectableLayer *layer, const TransposeConvolution2dDescriptor &descriptor, const ConstTensor &weights, const Optional< ConstTensor > &biases, const char *name=nullptr) override
 Function that a 2D transpose convolution layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitTransposeLayer (const IConnectableLayer *layer, const TransposeDescriptor &descriptor, const char *name=nullptr) override
 Function that a transpose layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
INetworkPtr RetrieveFinalNetwork ()
 Extract the quantized network. More...
 
- Public Member Functions inherited from LayerVisitorBase< VisitorThrowingPolicy >
void VisitAbsLayer (const IConnectableLayer *, const char *) override
 Function an absolute layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitActivationLayer (const IConnectableLayer *, const ActivationDescriptor &, const char *) override
 Function that an activation layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitAdditionLayer (const IConnectableLayer *, const char *) override
 Function that an addition layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitArgMinMaxLayer (const IConnectableLayer *, const ArgMinMaxDescriptor &, const char *) override
 Function that an arg min max layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitBatchNormalizationLayer (const IConnectableLayer *, const BatchNormalizationDescriptor &, const ConstTensor &, const ConstTensor &, const ConstTensor &, const ConstTensor &, const char *) override
 Function that a batch normalization layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitBatchToSpaceNdLayer (const IConnectableLayer *, const BatchToSpaceNdDescriptor &, const char *) override
 Function that a batch to space ND layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitComparisonLayer (const IConnectableLayer *, const ComparisonDescriptor &, const char *) override
 Function a Comparison layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitConcatLayer (const IConnectableLayer *, const ConcatDescriptor &, const char *) override
 Function that a concat layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitConstantLayer (const IConnectableLayer *, const ConstTensor &, const char *) override
 Function a layer with no inputs and a single output, which always corresponds to the passed in constant tensor should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitConvolution2dLayer (const IConnectableLayer *, const Convolution2dDescriptor &, const ConstTensor &, const Optional< ConstTensor > &, const char *) override
 Function that a 2D convolution layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitDepthToSpaceLayer (const IConnectableLayer *, const DepthToSpaceDescriptor &, const char *) override
 Function a depth to space layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitDepthwiseConvolution2dLayer (const IConnectableLayer *, const DepthwiseConvolution2dDescriptor &, const ConstTensor &, const Optional< ConstTensor > &, const char *) override
 Function that a 2D depthwise convolution layer with biases should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitDequantizeLayer (const IConnectableLayer *, const char *) override
 Function that a Dequantize layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitDetectionPostProcessLayer (const IConnectableLayer *, const DetectionPostProcessDescriptor &, const ConstTensor &, const char *) override
 Function that a Detection PostProcess layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitDivisionLayer (const IConnectableLayer *, const char *) override
 Function a division layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitElementwiseUnaryLayer (const IConnectableLayer *, const ElementwiseUnaryDescriptor &, const char *) override
 Function a ElementwiseUnary layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitEqualLayer (const IConnectableLayer *, const char *) override
 Function an Equal layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitFillLayer (const IConnectableLayer *, const FillDescriptor &, const char *) override
 Function a fill layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitFloorLayer (const IConnectableLayer *, const char *) override
 Function a floor layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitFullyConnectedLayer (const IConnectableLayer *, const FullyConnectedDescriptor &, const ConstTensor &, const Optional< ConstTensor > &, const char *) override
 Function that a fully connected layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitGatherLayer (const IConnectableLayer *, const char *) override
 Function a Gather layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitGatherLayer (const IConnectableLayer *, const GatherDescriptor &, const char *) override
 Function a Gather layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitGreaterLayer (const IConnectableLayer *, const char *) override
 Function a Greater layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitInputLayer (const IConnectableLayer *, LayerBindingId, const char *) override
 Function that an InputLayer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitInstanceNormalizationLayer (const IConnectableLayer *, const InstanceNormalizationDescriptor &, const char *) override
 Function that an instance normalization layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitL2NormalizationLayer (const IConnectableLayer *, const L2NormalizationDescriptor &, const char *) override
 Function that an L2 normalization layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitLogSoftmaxLayer (const IConnectableLayer *, const LogSoftmaxDescriptor &, const char *) override
 Function that a log softmax layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitLogicalBinaryLayer (const IConnectableLayer *, const LogicalBinaryDescriptor &, const char *) override
 Function that a logical binary layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitLstmLayer (const IConnectableLayer *, const LstmDescriptor &, const LstmInputParams &, const char *) override
 Function an Lstm layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitMaximumLayer (const IConnectableLayer *, const char *) override
 Function a Maximum layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitMeanLayer (const IConnectableLayer *, const MeanDescriptor &, const char *) override
 Function a Mean layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitMergeLayer (const IConnectableLayer *, const char *) override
 Function that a merge layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitMergerLayer (const IConnectableLayer *, const MergerDescriptor &, const char *) override
 Function that a merger layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitMinimumLayer (const IConnectableLayer *, const char *) override
 Function a Minimum layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitMultiplicationLayer (const IConnectableLayer *, const char *) override
 Function that a multiplication layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitNormalizationLayer (const IConnectableLayer *, const NormalizationDescriptor &, const char *) override
 Function that a normalization layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitOutputLayer (const IConnectableLayer *, LayerBindingId, const char *) override
 Function an output layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitPadLayer (const IConnectableLayer *, const PadDescriptor &, const char *) override
 Function a pad layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitPermuteLayer (const IConnectableLayer *, const PermuteDescriptor &, const char *) override
 Function that a permute layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitPooling2dLayer (const IConnectableLayer *, const Pooling2dDescriptor &, const char *) override
 Function that a pooling layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitPreluLayer (const IConnectableLayer *, const char *) override
 Function that a PReLU activation layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitQuantizeLayer (const IConnectableLayer *, const char *) override
 Function a quantize layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitQLstmLayer (const IConnectableLayer *, const QLstmDescriptor &, const LstmInputParams &, const char *) override
 Function a QLstm layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitQuantizedLstmLayer (const IConnectableLayer *, const QuantizedLstmInputParams &, const char *) override
 Function a QuantizedLstm layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitRankLayer (const IConnectableLayer *, const char *) override
 Function a rank layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitReshapeLayer (const IConnectableLayer *, const ReshapeDescriptor &, const char *) override
 Function a reshape layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitResizeBilinearLayer (const IConnectableLayer *, const ResizeBilinearDescriptor &, const char *) override
 Function that a resize bilinear layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitResizeLayer (const IConnectableLayer *, const ResizeDescriptor &, const char *) override
 Function that a resize layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitRsqrtLayer (const IConnectableLayer *, const char *) override
 Function a Reciprocal of square root layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitSliceLayer (const IConnectableLayer *, const SliceDescriptor &, const char *) override
 Function that a slice layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitSoftmaxLayer (const IConnectableLayer *, const SoftmaxDescriptor &, const char *) override
 Function that a softmax layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitSpaceToBatchNdLayer (const IConnectableLayer *, const SpaceToBatchNdDescriptor &, const char *) override
 Function a space to batch layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitSpaceToDepthLayer (const IConnectableLayer *, const SpaceToDepthDescriptor &, const char *) override
 Function a space to depth layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitSplitterLayer (const IConnectableLayer *, const ViewsDescriptor &, const char *) override
 Function that a splitter layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitStackLayer (const IConnectableLayer *, const StackDescriptor &, const char *) override
 Function a stack layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitStandInLayer (const IConnectableLayer *, const StandInDescriptor &, const char *) override
 Function a StandInLayer should call back to when its Accept(ILaterVisitor&) function is invoked. More...
 
void VisitStridedSliceLayer (const IConnectableLayer *, const StridedSliceDescriptor &, const char *) override
 Function a strided slice layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitSubtractionLayer (const IConnectableLayer *, const char *) override
 Function a subtraction layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitSwitchLayer (const IConnectableLayer *, const char *) override
 Function a switch layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitTransposeConvolution2dLayer (const IConnectableLayer *, const TransposeConvolution2dDescriptor &, const ConstTensor &, const Optional< ConstTensor > &, const char *) override
 Function that a 2D transpose convolution layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitTransposeLayer (const IConnectableLayer *, const TransposeDescriptor &, const char *) override
 Function that a transpose layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
- Public Member Functions inherited from ILayerVisitor
virtual void StartVisit ()
 
virtual void FinishVisit ()
 

Additional Inherited Members

- Protected Member Functions inherited from LayerVisitorBase< VisitorThrowingPolicy >
 LayerVisitorBase ()
 
virtual ~LayerVisitorBase ()
 
- Protected Member Functions inherited from ILayerVisitor
 ILayerVisitor ()
 
virtual ~ILayerVisitor ()
 

Detailed Description

Visitor object for quantizing layers in a network.

Definition at line 25 of file QuantizerVisitor.hpp.

Constructor & Destructor Documentation

◆ QuantizerVisitor()

◆ ~QuantizerVisitor()

~QuantizerVisitor ( )
default

Member Function Documentation

◆ RetrieveFinalNetwork()

INetworkPtr RetrieveFinalNetwork ( )
inline

Extract the quantized network.

Definition at line 199 of file QuantizerVisitor.hpp.

199 { return std::move(m_QuantizedNetwork); }

◆ VisitAbsLayer()

void VisitAbsLayer ( const IConnectableLayer layer,
const char *  name = nullptr 
)
overridevirtual

Functions to quantize the individual layers, overridden from ILayerVisitor.

Implements ILayerVisitor.

Definition at line 119 of file QuantizerVisitor.cpp.

References armnn::Abs, and QuantizerVisitor::VisitElementwiseUnaryLayer().

120 {
121  VisitElementwiseUnaryLayer(layer, ElementwiseUnaryDescriptor(UnaryOperation::Abs), name);
122 }
void VisitElementwiseUnaryLayer(const IConnectableLayer *layer, const ElementwiseUnaryDescriptor &elementwiseUnaryDescriptor, const char *name=nullptr) override
Function a ElementwiseUnary layer should call back to when its Accept(ILayerVisitor&) function is inv...

◆ VisitActivationLayer()

void VisitActivationLayer ( const IConnectableLayer layer,
const ActivationDescriptor activationDescriptor,
const char *  name = nullptr 
)
overridevirtual

Function that an activation layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
activationDescriptor- ActivationDescriptor to configure the activation.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 124 of file QuantizerVisitor.cpp.

127 {
128  IConnectableLayer* newLayer = m_QuantizedNetwork->AddActivationLayer(activationDescriptor, name);
129  RecordLayer(layer, newLayer);
130  SetQuantizedInputConnections(layer, newLayer);
131 }

◆ VisitAdditionLayer()

void VisitAdditionLayer ( const IConnectableLayer layer,
const char *  name = nullptr 
)
overridevirtual

Function that an addition layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 133 of file QuantizerVisitor.cpp.

134 {
135  IConnectableLayer* newLayer = m_QuantizedNetwork->AddAdditionLayer(name);
136  RecordLayer(layer, newLayer);
137  SetQuantizedInputConnections(layer, newLayer);
138 }

◆ VisitArgMinMaxLayer()

void VisitArgMinMaxLayer ( const IConnectableLayer layer,
const ArgMinMaxDescriptor argMinMaxDescriptor,
const char *  name = nullptr 
)
overridevirtual

Function that an arg min max layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
argMinMaxDescriptor- ArgMinMaxDescriptor to configure the activation.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 140 of file QuantizerVisitor.cpp.

143 {
144  IConnectableLayer* newLayer = m_QuantizedNetwork->AddArgMinMaxLayer(argMinMaxDescriptor, name);
145  RecordLayer(layer, newLayer);
146  SetQuantizedInputConnections(layer, newLayer);
147 }

◆ VisitBatchNormalizationLayer()

void VisitBatchNormalizationLayer ( const IConnectableLayer layer,
const BatchNormalizationDescriptor desc,
const ConstTensor mean,
const ConstTensor variance,
const ConstTensor beta,
const ConstTensor gamma,
const char *  name = nullptr 
)
overridevirtual

Function that a batch normalization layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
mean- Pre-calculated mean for each channel.
variance- Pre-calculated variance for each channel.
beta- Per-channel additive factor.
gamma- Per-channel multiplicative factor.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 149 of file QuantizerVisitor.cpp.

References armnn::CreateQuantizedConst().

156 {
157  std::vector<uint8_t> meanBacking;
158  ConstTensor qMean = CreateQuantizedConst(mean, meanBacking);
159 
160  std::vector<uint8_t> varianceBacking;
161  ConstTensor qVariance = CreateQuantizedConst(variance, varianceBacking);
162 
163  std::vector<uint8_t> betaBacking;
164  ConstTensor qBeta = CreateQuantizedConst(beta, betaBacking);
165 
166  std::vector<uint8_t> gammaBacking;
167  ConstTensor qGamma = CreateQuantizedConst(gamma, gammaBacking);
168 
169  IConnectableLayer* newLayer = m_QuantizedNetwork->AddBatchNormalizationLayer(desc,
170  qMean,
171  qVariance,
172  qBeta,
173  qGamma,
174  name);
175 
176  RecordLayer(layer, newLayer);
177  SetQuantizedInputConnections(layer, newLayer);
178 }
ConstTensor CreateQuantizedConst(const ConstTensor &tensor, std::vector< uint8_t > &backing)

◆ VisitBatchToSpaceNdLayer()

void VisitBatchToSpaceNdLayer ( const IConnectableLayer layer,
const BatchToSpaceNdDescriptor batchToSpaceNdDescriptor,
const char *  name = nullptr 
)
overridevirtual

Function that a batch to space ND layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
batchToSpaceNdDescriptor- Description of the layer.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 180 of file QuantizerVisitor.cpp.

183 {
184  IConnectableLayer* newLayer = m_QuantizedNetwork->AddBatchToSpaceNdLayer(batchToSpaceNdDescriptor, name);
185  RecordLayer(layer, newLayer);
186  SetQuantizedInputConnections(layer, newLayer);
187 }

◆ VisitComparisonLayer()

void VisitComparisonLayer ( const IConnectableLayer layer,
const ComparisonDescriptor comparisonDescriptor,
const char *  name = nullptr 
)
overridevirtual

Function a Comparison layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
comparisonDescriptor- Description of the layer.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 189 of file QuantizerVisitor.cpp.

192 {
193  IConnectableLayer* newLayer = m_QuantizedNetwork->AddComparisonLayer(comparisonDescriptor, name);
194  RecordLayer(layer, newLayer);
195  SetQuantizedInputConnections(layer, newLayer);
196 }

◆ VisitConcatLayer()

void VisitConcatLayer ( const IConnectableLayer layer,
const OriginsDescriptor concatDescriptor,
const char *  name = nullptr 
)
overridevirtual

Function that a concat layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
concatDescriptor- ConcatDescriptor (synonym for OriginsDescriptor) to configure the concatenation process. Number of Views must be equal to the number of inputs, and their order must match - e.g. first view corresponds to the first input, second view to the second input, etc....
name- Optional name for the layer.

Reimplemented from ILayerVisitor.

Definition at line 198 of file QuantizerVisitor.cpp.

201 {
202  IConnectableLayer* newLayer = m_QuantizedNetwork->AddConcatLayer(originsDescriptor, name);
203  RecordLayer(layer, newLayer);
204  SetQuantizedInputConnections(layer, newLayer);
205 }

◆ VisitConstantLayer()

void VisitConstantLayer ( const IConnectableLayer layer,
const ConstTensor input,
const char *  name = nullptr 
)
overridevirtual

Function a layer with no inputs and a single output, which always corresponds to the passed in constant tensor should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
input- Tensor to be provided as the only output of the layer. The layer will maintain its own copy of the tensor data, meaning the memory referenced by input can be freed or reused after this function is called.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 207 of file QuantizerVisitor.cpp.

References armnn::CreateQuantizedConst().

210 {
211  std::vector<uint8_t> inputBacking;
212  ConstTensor qInput = CreateQuantizedConst(input, inputBacking);
213 
214  IConnectableLayer* newLayer = m_QuantizedNetwork->AddConstantLayer(qInput, name);
215  RecordLayer(layer, newLayer);
216 }
ConstTensor CreateQuantizedConst(const ConstTensor &tensor, std::vector< uint8_t > &backing)

◆ VisitConvolution2dLayer()

void VisitConvolution2dLayer ( const IConnectableLayer layer,
const Convolution2dDescriptor convolution2dDescriptor,
const ConstTensor weights,
const Optional< ConstTensor > &  biases,
const char *  name = nullptr 
)
overridevirtual

Function that a 2D convolution layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
convolution2dDescriptor- Description of the 2D convolution layer.
weights- Tensor for the weights data.
biases- Optional tensor for the bias data. If specified, must match the output tensor shape.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 218 of file QuantizerVisitor.cpp.

References armnn::CreateQuantizedConst(), and OptionalBase::has_value().

223 {
224  std::vector<uint8_t> weightsBacking;
225  ConstTensor qWeights = CreateQuantizedConst(weights, weightsBacking);
226  Optional<ConstTensor> optionalQBiases;
227  std::vector<int32_t> biasesBacking;
228 
229  if (biases.has_value())
230  {
231  ConstTensor qBiases = CreateQuantizedBias(layer, qWeights, biases, biasesBacking);
232  optionalQBiases = Optional<ConstTensor>(qBiases);
233  }
234 
235  IConnectableLayer* newLayer = m_QuantizedNetwork->AddConvolution2dLayer(convolution2dDescriptor,
236  qWeights,
237  optionalQBiases,
238  name);
239 
240  RecordLayer(layer, newLayer);
241  SetQuantizedInputConnections(layer, newLayer);
242 }
ConstTensor CreateQuantizedConst(const ConstTensor &tensor, std::vector< uint8_t > &backing)

◆ VisitDepthToSpaceLayer()

void VisitDepthToSpaceLayer ( const IConnectableLayer layer,
const DepthToSpaceDescriptor depthToSpaceDescriptor,
const char *  name = nullptr 
)
overridevirtual

Function a depth to space layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
depthToSpaceDescriptor- Parameters for the depth to space operation.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 244 of file QuantizerVisitor.cpp.

247 {
248  IConnectableLayer* newLayer = m_QuantizedNetwork->AddDepthToSpaceLayer(descriptor, name);
249  RecordLayer(layer, newLayer);
250  SetQuantizedInputConnections(layer, newLayer);
251 }

◆ VisitDepthwiseConvolution2dLayer()

void VisitDepthwiseConvolution2dLayer ( const IConnectableLayer layer,
const DepthwiseConvolution2dDescriptor convolution2dDescriptor,
const ConstTensor weights,
const Optional< ConstTensor > &  biases,
const char *  name = nullptr 
)
overridevirtual

Function that a 2D depthwise convolution layer with biases should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
convolution2dDescriptor- Description of the 2D depthwise convolution layer.
weights- Tensor for the weights. Expected format: [channelMultiplier, inputChannels, height, width].
biases- Optional tensor for the bias data. If specified, must match the output tensor shape.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 253 of file QuantizerVisitor.cpp.

References armnn::CreateQuantizedConst(), and OptionalBase::has_value().

258 {
259  std::vector<uint8_t> weightsBacking;
260  ConstTensor qWeights = CreateQuantizedConst(weights, weightsBacking);
261  Optional<ConstTensor> optionalQBiases;
262  std::vector<int32_t> biasesBacking;
263 
264  if (biases.has_value())
265  {
266  ConstTensor qBiases = CreateQuantizedBias(layer, qWeights, biases, biasesBacking);
267  optionalQBiases = Optional<ConstTensor>(qBiases);
268  }
269 
270  IConnectableLayer* newLayer = m_QuantizedNetwork->AddDepthwiseConvolution2dLayer(desc,
271  qWeights,
272  optionalQBiases,
273  name);
274 
275  RecordLayer(layer, newLayer);
276  SetQuantizedInputConnections(layer, newLayer);
277 }
ConstTensor CreateQuantizedConst(const ConstTensor &tensor, std::vector< uint8_t > &backing)

◆ VisitElementwiseUnaryLayer()

void VisitElementwiseUnaryLayer ( const IConnectableLayer layer,
const ElementwiseUnaryDescriptor elementwiseUnaryDescriptor,
const char *  name = nullptr 
)
overridevirtual

Function a ElementwiseUnary layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
elementwiseUnaryDescriptor- Description of the layer.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 279 of file QuantizerVisitor.cpp.

Referenced by QuantizerVisitor::VisitAbsLayer(), and QuantizerVisitor::VisitRsqrtLayer().

282 {
283  IConnectableLayer* newLayer = m_QuantizedNetwork->AddElementwiseUnaryLayer(elementwiseUnaryDescriptor, name);
284  RecordLayer(layer, newLayer);
285  SetQuantizedInputConnections(layer, newLayer);
286 }

◆ VisitFillLayer()

void VisitFillLayer ( const IConnectableLayer layer,
const FillDescriptor fillDescriptor,
const char *  name 
)
overridevirtual

Function a fill layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
fillDescriptor- Description of the layer
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 288 of file QuantizerVisitor.cpp.

291 {
292  IConnectableLayer* newLayer = m_QuantizedNetwork->AddFillLayer(desc, name);
293  RecordLayer(layer, newLayer);
294  SetQuantizedInputConnections(layer, newLayer);
295 }

◆ VisitFullyConnectedLayer()

void VisitFullyConnectedLayer ( const IConnectableLayer layer,
const FullyConnectedDescriptor fullyConnectedDescriptor,
const ConstTensor weights,
const Optional< ConstTensor > &  biases,
const char *  name = nullptr 
)
overridevirtual

Function that a fully connected layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
fullyConnectedDescriptor- Description of the fully connected layer.
weights- Tensor for the weights data.
biases- Optional tensor for the bias data.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 297 of file QuantizerVisitor.cpp.

References armnn::CreateQuantizedConst(), and OptionalBase::has_value().

302 {
303  std::vector<uint8_t> weightsBacking;
304  ConstTensor qWeights = CreateQuantizedConst(weights, weightsBacking);
305  Optional<ConstTensor> optionalQBiases;
306  std::vector<int32_t> biasesBacking;
307 
308  if (biases.has_value())
309  {
310  ConstTensor qBiases = CreateQuantizedBias(layer, qWeights, biases, biasesBacking);
311  optionalQBiases = Optional<ConstTensor>(qBiases);
312  }
313 
314  IConnectableLayer* newLayer = m_QuantizedNetwork->AddFullyConnectedLayer(desc,
315  qWeights,
316  optionalQBiases,
317  name);
318 
319  RecordLayer(layer, newLayer);
320  SetQuantizedInputConnections(layer, newLayer);
321 }
ConstTensor CreateQuantizedConst(const ConstTensor &tensor, std::vector< uint8_t > &backing)

◆ VisitInputLayer()

void VisitInputLayer ( const IConnectableLayer layer,
LayerBindingId  id,
const char *  name = nullptr 
)
overridevirtual

Function that an InputLayer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
id- User generated id to uniquely identify a particular input. The same id needs to be specified when passing the inputs to the IRuntime::EnqueueWorkload() function.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 323 of file QuantizerVisitor.cpp.

References IOutputSlot::Connect(), armnn::Float16, armnn::Float32, TensorInfo::GetDataType(), IConnectableLayer::GetInputSlot(), IConnectableLayer::GetOutputSlot(), IOutputSlot::GetTensorInfo(), and IOutputSlot::SetTensorInfo().

324 {
325  const DataType dataType = layer->GetOutputSlot(0).GetTensorInfo().GetDataType();
326  IConnectableLayer* inputLayer = m_QuantizedNetwork->AddInputLayer(id, name);
327 
328  if (m_PreserveType && (dataType == DataType::Float32 || dataType == DataType::Float16))
329  {
330  IConnectableLayer* quantizeLayer = m_QuantizedNetwork->AddQuantizeLayer();
331  inputLayer->GetOutputSlot(0).Connect(quantizeLayer->GetInputSlot(0));
332  inputLayer->GetOutputSlot(0).SetTensorInfo(layer->GetOutputSlot(0).GetTensorInfo());
333  RecordLayer(layer, quantizeLayer);
334  }
335  else
336  {
337  RecordLayer(layer, inputLayer);
338  }
339 }
DataType
Definition: Types.hpp:32

◆ VisitInstanceNormalizationLayer()

void VisitInstanceNormalizationLayer ( const IConnectableLayer layer,
const InstanceNormalizationDescriptor desc,
const char *  name = nullptr 
)
overridevirtual

Function that an instance normalization layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
desc- Parameters for the instance normalization operation.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 341 of file QuantizerVisitor.cpp.

344 {
345  IConnectableLayer* newLayer = m_QuantizedNetwork->AddInstanceNormalizationLayer(descriptor, name);
346  RecordLayer(layer, newLayer);
347  SetQuantizedInputConnections(layer, newLayer);
348 }

◆ VisitLogSoftmaxLayer()

void VisitLogSoftmaxLayer ( const IConnectableLayer layer,
const LogSoftmaxDescriptor logSoftmaxDescriptor,
const char *  name = nullptr 
)
overridevirtual

Function that a log softmax layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
logSoftmaxDescriptor- LogSoftmaxDescriptor to configure the log softmax.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 350 of file QuantizerVisitor.cpp.

353 {
354  IConnectableLayer* newLayer = m_QuantizedNetwork->AddLogSoftmaxLayer(logSoftmaxDescriptor, name);
355  RecordLayer(layer, newLayer);
356  SetQuantizedInputConnections(layer, newLayer);
357 }

◆ VisitMeanLayer()

void VisitMeanLayer ( const IConnectableLayer layer,
const MeanDescriptor meanDescriptor,
const char *  name = nullptr 
)
overridevirtual

Function a Mean layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
meanDescriptor- Parameters for the mean operation.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 359 of file QuantizerVisitor.cpp.

362 {
363  IConnectableLayer* newLayer = m_QuantizedNetwork->AddMeanLayer(meanDescriptor, name);
364  RecordLayer(layer, newLayer);
365  SetQuantizedInputConnections(layer, newLayer);
366 }

◆ VisitMultiplicationLayer()

void VisitMultiplicationLayer ( const IConnectableLayer layer,
const char *  name = nullptr 
)
overridevirtual

Function that a multiplication layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 368 of file QuantizerVisitor.cpp.

370 {
371  IConnectableLayer* newLayer = m_QuantizedNetwork->AddMultiplicationLayer(name);
372  RecordLayer(layer, newLayer);
373  SetQuantizedInputConnections(layer, newLayer);
374 }

◆ VisitNormalizationLayer()

void VisitNormalizationLayer ( const IConnectableLayer layer,
const NormalizationDescriptor normalizationDescriptor,
const char *  name = nullptr 
)
overridevirtual

Function that a normalization layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
normalizationDescriptor- NormalizationDescriptor to configure the normalization.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 376 of file QuantizerVisitor.cpp.

379 {
380  IConnectableLayer* newLayer = m_QuantizedNetwork->AddNormalizationLayer(normalizationDescriptor, name);
381  RecordLayer(layer, newLayer);
382  SetQuantizedInputConnections(layer, newLayer);
383 }

◆ VisitOutputLayer()

void VisitOutputLayer ( const IConnectableLayer layer,
LayerBindingId  id,
const char *  name = nullptr 
)
overridevirtual

Function an output layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
id- User generated id to uniquely identify a particular output. The same id needs to be specified when passing the outputs to the IRuntime::EnqueueWorkload() function.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 385 of file QuantizerVisitor.cpp.

References IOutputSlot::Connect(), armnn::Float16, armnn::Float32, IInputSlot::GetConnection(), TensorInfo::GetDataType(), IConnectableLayer::GetInputSlot(), IConnectableLayer::GetOutputSlot(), IOutputSlot::GetTensorInfo(), armnn::info, and IOutputSlot::SetTensorInfo().

386 {
387  const TensorInfo& info = layer->GetInputSlot(0).GetConnection()->GetTensorInfo();
388  const DataType& dataType = info.GetDataType();
389  IConnectableLayer* outputLayer = m_QuantizedNetwork->AddOutputLayer(id, name);
390 
391  if (m_PreserveType && (dataType == DataType::Float32 || dataType == DataType::Float16))
392  {
393  IConnectableLayer* dequantizeLayer = m_QuantizedNetwork->AddDequantizeLayer();
394  RecordLayer(layer, dequantizeLayer);
395  SetQuantizedInputConnections(layer, dequantizeLayer);
396  dequantizeLayer->GetOutputSlot(0).Connect(outputLayer->GetInputSlot(0));
397  dequantizeLayer->GetOutputSlot(0).SetTensorInfo(info);
398  }
399  else
400  {
401  RecordLayer(layer, outputLayer);
402  SetQuantizedInputConnections(layer, outputLayer);
403  }
404 }
DataType
Definition: Types.hpp:32

◆ VisitPadLayer()

void VisitPadLayer ( const IConnectableLayer layer,
const PadDescriptor padDescriptor,
const char *  name = nullptr 
)
overridevirtual

Function a pad layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
paddings- n by 2 tensor, where n is the rank of the input tensor, such that paddings[i,0] indicates the amount of padding to add in front of dimension i, and paddings[i,1] indicates the amount of padding to add after the end of dimension i
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 406 of file QuantizerVisitor.cpp.

409 {
410  IConnectableLayer* newLayer = m_QuantizedNetwork->AddPadLayer(padDescriptor, name);
411  RecordLayer(layer, newLayer);
412  SetQuantizedInputConnections(layer, newLayer);
413 }

◆ VisitPermuteLayer()

void VisitPermuteLayer ( const IConnectableLayer layer,
const PermuteDescriptor permuteDescriptor,
const char *  name = nullptr 
)
overridevirtual

Function that a permute layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
permuteDescriptor- PermuteDescriptor to configure the permute.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 415 of file QuantizerVisitor.cpp.

418 {
419  IConnectableLayer* newLayer = m_QuantizedNetwork->AddPermuteLayer(permuteDescriptor, name);
420  RecordLayer(layer, newLayer);
421  SetQuantizedInputConnections(layer, newLayer);
422 }

◆ VisitPooling2dLayer()

void VisitPooling2dLayer ( const IConnectableLayer layer,
const Pooling2dDescriptor pooling2dDescriptor,
const char *  name = nullptr 
)
overridevirtual

Function that a pooling layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
pooling2dDescriptor- Pooling2dDescriptor to configure the pooling.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 424 of file QuantizerVisitor.cpp.

427 {
428  IConnectableLayer* newLayer = m_QuantizedNetwork->AddPooling2dLayer(pooling2dDescriptor, name);
429  RecordLayer(layer, newLayer);
430  SetQuantizedInputConnections(layer, newLayer);
431 }

◆ VisitPreluLayer()

void VisitPreluLayer ( const IConnectableLayer layer,
const char *  name = nullptr 
)
overridevirtual

Function that a PReLU activation layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 433 of file QuantizerVisitor.cpp.

435 {
436  IConnectableLayer* newLayer = m_QuantizedNetwork->AddPreluLayer(name);
437  RecordLayer(layer, newLayer);
438  SetQuantizedInputConnections(layer, newLayer);
439 }

◆ VisitReshapeLayer()

void VisitReshapeLayer ( const IConnectableLayer layer,
const ReshapeDescriptor reshapeDescriptor,
const char *  name = nullptr 
)
overridevirtual

Function a reshape layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
reshapeDescriptor- Parameters for the reshape operation.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 441 of file QuantizerVisitor.cpp.

444 {
445  IConnectableLayer* newLayer = m_QuantizedNetwork->AddReshapeLayer(reshapeDescriptor, name);
446  RecordLayer(layer, newLayer);
447  SetQuantizedInputConnections(layer, newLayer);
448 }

◆ VisitResizeBilinearLayer()

void VisitResizeBilinearLayer ( const IConnectableLayer layer,
const ResizeBilinearDescriptor resizeDesc,
const char *  name = nullptr 
)
overridevirtual

Function that a resize bilinear layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
resizeDesc- Parameters for the resize operation.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 450 of file QuantizerVisitor.cpp.

References armnn::Bilinear, ResizeBilinearDescriptor::m_DataLayout, ResizeDescriptor::m_DataLayout, ResizeDescriptor::m_Method, ResizeBilinearDescriptor::m_TargetHeight, ResizeDescriptor::m_TargetHeight, ResizeBilinearDescriptor::m_TargetWidth, ResizeDescriptor::m_TargetWidth, and QuantizerVisitor::VisitResizeLayer().

453 {
454  ResizeDescriptor resizeDescriptor;
455  resizeDescriptor.m_Method = ResizeMethod::Bilinear;
456  resizeDescriptor.m_TargetWidth = resizeBilinearDescriptor.m_TargetWidth;
457  resizeDescriptor.m_TargetHeight = resizeBilinearDescriptor.m_TargetHeight;
458  resizeDescriptor.m_DataLayout = resizeBilinearDescriptor.m_DataLayout;
459 
460  VisitResizeLayer(layer, resizeDescriptor, name);
461 }
void VisitResizeLayer(const IConnectableLayer *layer, const ResizeDescriptor &resizeDescriptor, const char *name=nullptr) override
Function that a resize layer should call back to when its Accept(ILayerVisitor&) function is invoked...

◆ VisitResizeLayer()

void VisitResizeLayer ( const IConnectableLayer layer,
const ResizeDescriptor resizeDescriptor,
const char *  name = nullptr 
)
overridevirtual

Function that a resize layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
resizeDescriptor- Parameters for the resize operation.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 463 of file QuantizerVisitor.cpp.

Referenced by QuantizerVisitor::VisitResizeBilinearLayer().

466 {
467  IConnectableLayer* newLayer = m_QuantizedNetwork->AddResizeLayer(resizeDescriptor, name);
468  RecordLayer(layer, newLayer);
469  SetQuantizedInputConnections(layer, newLayer);
470 }

◆ VisitRsqrtLayer()

void VisitRsqrtLayer ( const IConnectableLayer layer,
const char *  name = nullptr 
)
overridevirtual

Function a Reciprocal of square root layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 472 of file QuantizerVisitor.cpp.

References armnn::Rsqrt, and QuantizerVisitor::VisitElementwiseUnaryLayer().

473 {
474  VisitElementwiseUnaryLayer(layer, ElementwiseUnaryDescriptor(UnaryOperation::Rsqrt), name);
475 }
void VisitElementwiseUnaryLayer(const IConnectableLayer *layer, const ElementwiseUnaryDescriptor &elementwiseUnaryDescriptor, const char *name=nullptr) override
Function a ElementwiseUnary layer should call back to when its Accept(ILayerVisitor&) function is inv...

◆ VisitSliceLayer()

void VisitSliceLayer ( const IConnectableLayer layer,
const SliceDescriptor sliceDescriptor,
const char *  name = nullptr 
)
overridevirtual

Function that a slice layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
sliceDescriptor- SliceDescriptor to configure the slice operation.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 477 of file QuantizerVisitor.cpp.

480 {
481  IConnectableLayer* newLayer = m_QuantizedNetwork->AddSliceLayer(sliceDescriptor, name);
482  RecordLayer(layer, newLayer);
483  SetQuantizedInputConnections(layer, newLayer);
484 }

◆ VisitSoftmaxLayer()

void VisitSoftmaxLayer ( const IConnectableLayer layer,
const SoftmaxDescriptor softmaxDescriptor,
const char *  name = nullptr 
)
overridevirtual

Function that a softmax layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
softmaxDescriptor- SoftmaxDescriptor to configure the softmax.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 486 of file QuantizerVisitor.cpp.

489 {
490  IConnectableLayer* newLayer = m_QuantizedNetwork->AddSoftmaxLayer(softmaxDescriptor, name);
491  RecordLayer(layer, newLayer);
492  SetQuantizedInputConnections(layer, newLayer);
493 }

◆ VisitSpaceToBatchNdLayer()

void VisitSpaceToBatchNdLayer ( const IConnectableLayer layer,
const SpaceToBatchNdDescriptor spaceToBatchNdDescriptor,
const char *  name = nullptr 
)
overridevirtual

Function a space to batch layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
spaceToBatchNdDescriptor- Parameters for the space to batch operation.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 495 of file QuantizerVisitor.cpp.

498 {
499  IConnectableLayer* newLayer = m_QuantizedNetwork->AddSpaceToBatchNdLayer(spaceToBatchNdDescriptor, name);
500  RecordLayer(layer, newLayer);
501  SetQuantizedInputConnections(layer, newLayer);
502 }

◆ VisitSpaceToDepthLayer()

void VisitSpaceToDepthLayer ( const IConnectableLayer layer,
const SpaceToDepthDescriptor spaceToDepthDescriptor,
const char *  name = nullptr 
)
overridevirtual

Function a space to depth layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
spaceToDepthDescriptor- Parameters for the space to depth operation.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 504 of file QuantizerVisitor.cpp.

507 {
508  IConnectableLayer* newLayer = m_QuantizedNetwork->AddSpaceToDepthLayer(spaceToDepthDescriptor, name);
509  RecordLayer(layer, newLayer);
510  SetQuantizedInputConnections(layer, newLayer);
511 }

◆ VisitSplitterLayer()

void VisitSplitterLayer ( const IConnectableLayer layer,
const SplitterDescriptor splitterDescriptor,
const char *  name = nullptr 
)
overridevirtual

Function that a splitter layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
splitterDescriptor- ViewsDescriptor to configure the splitting process. Number of Views must be equal to the number of outputs, and their order must match - e.g. first view corresponds to the first output, second view to the second output, etc....
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 513 of file QuantizerVisitor.cpp.

516 {
517  IConnectableLayer* newLayer = m_QuantizedNetwork->AddSplitterLayer(splitterDescriptor, name);
518  RecordLayer(layer, newLayer);
519  SetQuantizedInputConnections(layer, newLayer);
520 }

◆ VisitStackLayer()

void VisitStackLayer ( const IConnectableLayer layer,
const StackDescriptor stackDescriptor,
const char *  name = nullptr 
)
overridevirtual

Function a stack layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
stackDescriptor- Parameters for the stack operation.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 522 of file QuantizerVisitor.cpp.

525 {
526  IConnectableLayer* newLayer = m_QuantizedNetwork->AddStackLayer(stackDescriptor, name);
527  RecordLayer(layer, newLayer);
528  SetQuantizedInputConnections(layer, newLayer);
529 }

◆ VisitStridedSliceLayer()

void VisitStridedSliceLayer ( const IConnectableLayer layer,
const StridedSliceDescriptor stridedSliceDescriptor,
const char *  name = nullptr 
)
overridevirtual

Function a strided slice layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
stridedSliceDescriptor- Parameters for the strided slice operation.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 531 of file QuantizerVisitor.cpp.

534 {
535  IConnectableLayer* newLayer = m_QuantizedNetwork->AddStridedSliceLayer(stridedSliceDescriptor, name);
536  RecordLayer(layer, newLayer);
537  SetQuantizedInputConnections(layer, newLayer);
538 }

◆ VisitSubtractionLayer()

void VisitSubtractionLayer ( const IConnectableLayer layer,
const char *  name = nullptr 
)
overridevirtual

Function a subtraction layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 540 of file QuantizerVisitor.cpp.

542 {
543  IConnectableLayer* newLayer = m_QuantizedNetwork->AddSubtractionLayer(name);
544  RecordLayer(layer, newLayer);
545  SetQuantizedInputConnections(layer, newLayer);
546 }

◆ VisitTransposeConvolution2dLayer()

void VisitTransposeConvolution2dLayer ( const IConnectableLayer layer,
const TransposeConvolution2dDescriptor descriptor,
const ConstTensor weights,
const Optional< ConstTensor > &  biases,
const char *  name = nullptr 
)
overridevirtual

Function that a 2D transpose convolution layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
descriptor- Description of the 2D transpose convolution layer.
weights- Tensor for the weights data.
biases- Optional tensor for the bias data.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 548 of file QuantizerVisitor.cpp.

References armnn::CreateQuantizedConst(), and OptionalBase::has_value().

553 {
554  // quantize weights
555  std::vector<uint8_t> weightsBacking;
556  ConstTensor qWeights = CreateQuantizedConst(weights, weightsBacking);
557 
558  // quantize biases
559  std::vector<int32_t> biasesBacking;
560  Optional<ConstTensor> optionalQBiases;
561  if (biases.has_value())
562  {
563  ConstTensor qBiases = CreateQuantizedBias(layer, qWeights, biases, biasesBacking);
564  optionalQBiases = Optional<ConstTensor>(qBiases);
565  }
566 
567  IConnectableLayer* newLayer = m_QuantizedNetwork->AddTransposeConvolution2dLayer(descriptor,
568  qWeights,
569  optionalQBiases,
570  name);
571 
572  RecordLayer(layer, newLayer);
573  SetQuantizedInputConnections(layer, newLayer);
574 }
ConstTensor CreateQuantizedConst(const ConstTensor &tensor, std::vector< uint8_t > &backing)

◆ VisitTransposeLayer()

void VisitTransposeLayer ( const IConnectableLayer layer,
const TransposeDescriptor transposeDescriptor,
const char *  name = nullptr 
)
overridevirtual

Function that a transpose layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
transposeDescriptor- TransposeDescriptor to configure the transpose.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 576 of file QuantizerVisitor.cpp.

579 {
580  IConnectableLayer* newLayer = m_QuantizedNetwork->AddTransposeLayer(transposeDescriptor, name);
581  RecordLayer(layer, newLayer);
582  SetQuantizedInputConnections(layer, newLayer);
583 }

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