TensorRT 10.8.0
nvinfer1::ISoftMaxLayer 类参考

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

#include <NvInfer.h>

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

公共成员函数

void setAxes (uint32_t axes) noexcept
 设置计算 softmax 的轴。目前,只能设置一个轴。 更多...
 
uint32_t getAxes () const noexcept
 获取 softmax 发生的轴。 更多...
 
- 继承自 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 ~ISoftMaxLayer () 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::VSoftMaxLayer * mImpl
 
- 继承自 nvinfer1::ILayer 的保护属性
apiv::VLayer * mLayer
 

详细描述

网络定义中的 Softmax 层。

此层对其输入应用逐通道的 softmax。

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

必须满足以下约束才能在 DLA 上执行此层

  • 轴必须是通道或空间维度之一。
  • 支持两种类型的输入大小
    1. 非轴、非批次维度均为 1,轴维度最大为 8192。这是使用 softmax 的推荐情况,因为它最准确。
    2. 至少一个非轴、非批次维度大于 1,轴维度最大为 1024。请注意,在这种情况下,当轴维度大小接近上限时,可能会存在一些近似误差。有关近似误差的更多详细信息,请参阅 TensorRT 开发者指南。
警告
不要从此类继承,因为这样做会破坏 API 和 ABI 的向前兼容性。

构造函数 & 析构函数文档

◆ ~ISoftMaxLayer()

virtual nvinfer1::ISoftMaxLayer::~ISoftMaxLayer ( )
protectedvirtualdefaultnoexcept

成员函数文档

◆ getAxes()

uint32_t nvinfer1::ISoftMaxLayer::getAxes ( ) const
inlinenoexcept

获取 softmax 发生的轴。

另请参阅
setAxes()

◆ setAxes()

void nvinfer1::ISoftMaxLayer::setAxes ( uint32_t  axes)
inlinenoexcept

设置计算 softmax 的轴。目前,只能设置一个轴。

轴通过设置与轴对应的位为 1 来指定。例如,考虑 NCHW 张量作为输入。

位 0 对应于 N 维度布尔值。位 1 对应于 C 维度布尔值。位 2 对应于 H 维度布尔值。位 3 对应于 W 维度布尔值。默认情况下,softmax 在轴数减三的轴上执行。如果轴数少于 3,则为 0。例如,如果输入是 NCHW,则默认轴是 C。如果输入是 NHW,则默认轴是 N。

例如,要在 NPQRCHW 输入的 R 轴上执行 softmax,请设置位 3。

参数
axes计算 softmax 的轴。此处 axes 是一个位图。例如,当沿轴 0 执行 softmax 时,位 0 设置为 1,axes = 1 << axis = 1。

成员数据文档

◆ mImpl

apiv::VSoftMaxLayer* nvinfer1::ISoftMaxLayer::mImpl
protected

此类文档从以下文件生成

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