TensorRT 10.8.0
nvinfer1::IScaleLayer 类参考

网络定义中的 Scale 层。 更多...

#include <NvInfer.h>

nvinfer1::IScaleLayer 的继承关系图
nvinfer1::ILayer nvinfer1::INoCopy

公共成员函数

void setMode (ScaleMode mode) noexcept
 设置缩放模式。 更多...
 
ScaleMode getMode () const noexcept
 获取缩放模式。 更多...
 
void setShift (Weights shift) noexcept
 设置偏移值。 更多...
 
Weights getShift () const noexcept
 获取偏移值。 更多...
 
void setScale (Weights scale) noexcept
 设置缩放值。 更多...
 
Weights getScale () const noexcept
 获取缩放值。 更多...
 
void setPower (Weights power) noexcept
 设置幂值。 更多...
 
Weights getPower () const noexcept
 获取幂值。 更多...
 
int32_t getChannelAxis () const noexcept
 获取通道轴。 更多...
 
void setChannelAxis (int32_t channelAxis) noexcept
 设置通道轴。 更多...
 
- 继承自 nvinfer1::ILayer 的公共成员函数
LayerType getType () const noexcept
 返回层的类型。 更多...
 
void setName (char const *name) noexcept
 设置层的名称。 更多...
 
char const * getName () const noexcept
 返回层的名称。 更多...
 
int32_t getNbInputs () const noexcept
 获取层的输入数量。 更多...
 
ITensorgetInput (int32_t index) const noexcept
 获取与给定索引对应的层输入。 更多...
 
int32_t getNbOutputs () const noexcept
 获取层的输出数量。 更多...
 
ITensorgetOutput (int32_t index) const noexcept
 获取与给定索引对应的层输出。 更多...
 
void setInput (int32_t index, ITensor &tensor) noexcept
 使用特定张量替换此层的输入。 更多...
 
void setPrecision (DataType dataType) noexcept
 在弱类型网络中设置此层的首选或必需的计算精度。 更多...
 
DataType getPrecision () const noexcept
 获取此层的计算精度 更多...
 
bool precisionIsSet () const noexcept
 是否为此层设置了计算精度 更多...
 
void resetPrecision () noexcept
 重置此层的计算精度 更多...
 
void setOutputType (int32_t index, DataType dataType) noexcept
 在弱类型网络中设置此层的输出类型。 更多...
 
DataType getOutputType (int32_t index) const noexcept
 获取此层的输出类型 更多...
 
bool outputTypeIsSet (int32_t index) const noexcept
 是否为此层设置了输出类型 更多...
 
void resetOutputType (int32_t index) noexcept
 重置此层的输出类型 更多...
 
void setMetadata (char const *metadata) noexcept
 为此层设置元数据。 更多...
 
char const * getMetadata () const noexcept
 获取层的元数据。 更多...
 

受保护的成员函数

virtual ~IScaleLayer () noexcept=default
 
- 继承自 nvinfer1::ILayer 的受保护的成员函数
virtual ~ILayer () noexcept=default
 
- 继承自 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
 

受保护的属性

apiv::VScaleLayer * mImpl
 
- 继承自 nvinfer1::ILayer 的受保护的属性
apiv::VLayer * mLayer
 

详细描述

网络定义中的 Scale 层。

此层对其输入应用逐元素计算

output = (input* scale + shift)^ power

系数可以按每张量、每通道或每元素的方式应用。

注意
如果权重的数量为 0,则偏移、幂和缩放将使用默认值。默认偏移为 0,默认幂为 1,默认缩放为 1。

输出大小与输入大小相同。

注意
输入张量必须至少有 4 个维度。

如果输出被约束为 INT8,而输入为 FP32,则 Scale 层可以用作图中的 INT8 量化节点。量化将关系舍入为偶数,并钳制到 [-128, 127]。

另请参阅
ScaleMode
警告
不要从此类继承,因为这样做会破坏 API 和 ABI 的向前兼容性。

构造函数和析构函数文档

◆ ~IScaleLayer()

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

成员函数文档

◆ getChannelAxis()

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

获取通道轴。

返回值
传递给 addScaleNd() 或由 setChannelAxis() 设置的 channelAxis 参数

该值是输入张量维度中通道轴的索引。当启用 ScaleMode::kCHANNEL 时,缩放沿通道轴发生。

另请参阅
addScaleNd()

◆ getMode()

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

获取缩放模式。

另请参阅
setMode()

◆ getPower()

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

获取幂值。

另请参阅
setPower()

◆ getScale()

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

获取缩放值。

另请参阅
setScale()

◆ getShift()

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

获取偏移值。

另请参阅
setShift()

◆ setChannelAxis()

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

设置通道轴。

该值是输入张量维度中通道轴的索引。

对于 ScaleMode::kCHANNEL,每个通道坐标可以有不同的缩放、偏移和幂权重。对于 ScaleMode::kELEMENTWISE,从通道轴及其后的轴的每个坐标组合可以有不同的缩放、偏移和幂权重。

例如,假设输入张量的维度为 [10,20,30,40],通道轴为 1。令 [n,c,h,w] 表示输入坐标。对于 ScaleMode::kCHANNEL,缩放、偏移和幂权重由 c 索引。对于 ScaleMode::kELEMENTWISE,缩放、偏移和幂权重由 [c,h,w] 索引。

另请参阅
addScaleNd()

◆ setMode()

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

设置缩放模式。

另请参阅
getMode()

◆ setPower()

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

设置幂值。

另请参阅
getPower()

◆ setScale()

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

设置缩放值。

另请参阅
getScale()

◆ setShift()

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

设置偏移值。

另请参阅
getShift()

成员数据文档

◆ mImpl

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

此类文档从以下文件生成

  版权所有 © 2024 NVIDIA Corporation
  隐私政策 | 管理我的隐私 | 请勿出售或分享我的数据 | 服务条款 | 辅助功能 | 公司政策 | 产品安全 | 联系我们