TensorRT 10.8.0
nvinfer1::IOneHotLayer 类参考

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

#include <NvInfer.h>

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

公共成员函数

void setAxis (int32_t axis) noexcept
 设置 axis 参数。 更多...
 
int32_t getAxis () const noexcept
 获取 axis 参数的值。 更多...
 
- 继承自 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
 用特定的 tensor 替换此层的输入。 更多...
 
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
 获取层的元数据。 更多...
 

保护属性

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

附加继承成员

- 继承自 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
 

详细描述

网络定义中的 OneHot 层。

OneHot 层有三个输入 tensors: Indices, Values, 和 Depth, 一个输出 tensor: Output, 和一个 axis 属性。

  • Indices 是一个 Int32 tensor,用于确定在 Output 中将哪些位置设置为 on_value。
  • Values 是一个双元素 (rank=1) tensor,由 [off_value, on_value] 组成
  • Depth 是一个 0D tensor,类型为 Int32 或 Int64,其中包含 one-hot 编码的深度(类别数)。 depth tensor 必须是正的构建时常量。
  • Output 是一个 rank = rank(indices)+1 的 tensor,其中添加的维度包含 one-hot 编码。 Output 的数据类型等于 Values 数据类型。
  • Axis 是一个标量,指定 one-hot 编码被添加到输出的哪个维度。 axis 的有效范围是 -rank(indices)-1 <= axis <= rank(indices)。

输出的计算方式是将 off_values 复制到所有输出元素,然后在 indices tensor 指定的索引处设置 on_value。当 axis = 0 时:对于所有 i, j, k,output[indices[i, j, k], i, j, k] = on_value,否则为 off_value。

当 axis = -1 时:对于所有 i, j, k,output[i, j, k, indices[i, j, k]] = on_value,否则为 off_value。

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

成员函数文档

◆ getAxis()

int32_t nvinfer1::IOneHotLayer::getAxis ( ) const
inlinenoexcept

获取 axis 参数的值。

◆ setAxis()

void nvinfer1::IOneHotLayer::setAxis ( int32_t  axis)
inlinenoexcept

设置 axis 参数。

另请参阅
IOneHotLayer

成员数据文档

◆ mImpl

apiv::VOneHotLayer* nvinfer1::IOneHotLayer::mImpl
protected

此类文档从以下文件生成

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