TensorRT 10.7.0
nvinfer1::IScaleLayer Class Reference

A Scale layer in a network definition. More...

#include <NvInfer.h>

Inheritance diagram for nvinfer1::IScaleLayer:
nvinfer1::ILayer nvinfer1::INoCopy

Public Member Functions

void setMode (ScaleMode mode) noexcept
 Set the scale mode. More...
 
ScaleMode getMode () const noexcept
 Get the scale mode. More...
 
void setShift (Weights shift) noexcept
 Set the shift value. More...
 
Weights getShift () const noexcept
 Get the shift value. More...
 
void setScale (Weights scale) noexcept
 Set the scale value. More...
 
Weights getScale () const noexcept
 Get the scale value. More...
 
void setPower (Weights power) noexcept
 Set the power value. More...
 
Weights getPower () const noexcept
 Get the power value. More...
 
int32_t getChannelAxis () const noexcept
 Get the channel axis. More...
 
void setChannelAxis (int32_t channelAxis) noexcept
 Set the channel axis. More...
 
- Public Member Functions inherited from nvinfer1::ILayer
LayerType getType () const noexcept
 Return the type of a layer. More...
 
void setName (char const *name) noexcept
 Set the name of a layer. More...
 
char const * getName () const noexcept
 Return the name of a layer. More...
 
int32_t getNbInputs () const noexcept
 Get the number of inputs of a layer. More...
 
ITensorgetInput (int32_t index) const noexcept
 Get the layer input corresponding to the given index. More...
 
int32_t getNbOutputs () const noexcept
 Get the number of outputs of a layer. More...
 
ITensorgetOutput (int32_t index) const noexcept
 Get the layer output corresponding to the given index. More...
 
void setInput (int32_t index, ITensor &tensor) noexcept
 Replace an input of this layer with a specific tensor. More...
 
void setPrecision (DataType dataType) noexcept
 Set the preferred or required computational precision of this layer in a weakly-typed network. More...
 
DataType getPrecision () const noexcept
 get the computational precision of this layer More...
 
bool precisionIsSet () const noexcept
 whether the computational precision has been set for this layer More...
 
void resetPrecision () noexcept
 reset the computational precision for this layer More...
 
void setOutputType (int32_t index, DataType dataType) noexcept
 Set the output type of this layer in a weakly-typed network. More...
 
DataType getOutputType (int32_t index) const noexcept
 get the output type of this layer More...
 
bool outputTypeIsSet (int32_t index) const noexcept
 whether the output type has been set for this layer More...
 
void resetOutputType (int32_t index) noexcept
 reset the output type for this layer More...
 
void setMetadata (char const *metadata) noexcept
 Set the metadata for this layer. More...
 
char const * getMetadata () const noexcept
 Get the metadata of the layer. More...
 

Protected Member Functions

virtual ~IScaleLayer () noexcept=default
 
- Protected Member Functions inherited from nvinfer1::ILayer
virtual ~ILayer () noexcept=default
 
- Protected Member Functions inherited from nvinfer1::INoCopy
 INoCopy ()=default
 
virtual ~INoCopy ()=default
 
 INoCopy (INoCopy const &other)=delete
 
INoCopyoperator= (INoCopy const &other)=delete
 
 INoCopy (INoCopy &&other)=delete
 
INoCopyoperator= (INoCopy &&other)=delete
 

Protected Attributes

apiv::VScaleLayer * mImpl
 
- Protected Attributes inherited from nvinfer1::ILayer
apiv::VLayer * mLayer
 

Detailed Description

A Scale layer in a network definition.

This layer applies a per-element computation to its input:

output = (input* scale + shift)^ power

The coefficients can be applied on a per-tensor, per-channel, or per-element basis.

Note
If the number of weights is 0, then a default value is used for shift, power, and scale. The default shift is 0, the default power is 1, and the default scale is 1.

The output size is the same as the input size.

Note
The input tensor is required to have at least 4 dimensions.

A scale layer may be used as an INT8 quantization node in a graph, if the output is constrained to INT8 and the input to FP32. Quantization rounds ties to even, and clamps to [-128, 127].

See also
ScaleMode
Warning
Do not inherit from this class, as doing so will break forward-compatibility of the API and ABI.

Constructor & Destructor Documentation

◆ ~IScaleLayer()

virtual nvinfer1::IScaleLayer::~IScaleLayer ( )
protectedvirtualdefaultnoexcept

Member Function Documentation

◆ getChannelAxis()

int32_t nvinfer1::IScaleLayer::getChannelAxis ( ) const
inlinenoexcept

Get the channel axis.

Returns
channelAxis parameter passed to addScaleNd() or set by setChannelAxis()

The value is the index of the channel axis in the input tensor's dimensions. Scaling happens along the channel axis when ScaleMode::kCHANNEL is enabled.

See also
addScaleNd()

◆ getMode()

ScaleMode nvinfer1::IScaleLayer::getMode ( ) const
inlinenoexcept

Get the scale mode.

See also
setMode()

◆ getPower()

Weights nvinfer1::IScaleLayer::getPower ( ) const
inlinenoexcept

Get the power value.

See also
setPower()

◆ getScale()

Weights nvinfer1::IScaleLayer::getScale ( ) const
inlinenoexcept

Get the scale value.

See also
setScale()

◆ getShift()

Weights nvinfer1::IScaleLayer::getShift ( ) const
inlinenoexcept

Get the shift value.

See also
setShift()

◆ setChannelAxis()

void nvinfer1::IScaleLayer::setChannelAxis ( int32_t  channelAxis)
inlinenoexcept

Set the channel axis.

The value is the index of the channel axis in the input tensor's dimensions.

For ScaleMode::kCHANNEL, there can be distinct scale, shift, and power weights for each channel coordinate. For ScaleMode::kELEMENTWISE, there can be distinct scale, shift, and power weights for each combination of coordinates from the channel axis and axes after it.

For example, suppose the input tensor has dimensions [10,20,30,40] and the channel axis is 1. Let [n,c,h,w] denote an input coordinate. For ScaleMode::kCHANNEL, the scale, shift, and power weights are indexed by c. For ScaleMode::kELEMENTWISE, the scale, shift, and power weights are indexed by [c,h,w].

See also
addScaleNd()

◆ setMode()

void nvinfer1::IScaleLayer::setMode ( ScaleMode  mode)
inlinenoexcept

Set the scale mode.

See also
getMode()

◆ setPower()

void nvinfer1::IScaleLayer::setPower ( Weights  power)
inlinenoexcept

Set the power value.

See also
getPower()

◆ setScale()

void nvinfer1::IScaleLayer::setScale ( Weights  scale)
inlinenoexcept

Set the scale value.

See also
getScale()

◆ setShift()

void nvinfer1::IScaleLayer::setShift ( Weights  shift)
inlinenoexcept

Set the shift value.

See also
getShift()

Member Data Documentation

◆ mImpl

apiv::VScaleLayer* nvinfer1::IScaleLayer::mImpl
protected

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

  Copyright © 2024 NVIDIA Corporation
  Privacy Policy | Manage My Privacy | Do Not Sell or Share My Data | Terms of Service | Accessibility | Corporate Policies | Product Security | Contact