TensorRT 10.8.0
|
根据指定的模式生成张量。 更多...
#include <NvInfer.h>
公共成员函数 | |
void | setDimensions (Dims const &dimensions) noexcept |
设置输出张量的维度。 更多... | |
Dims | getDimensions () const noexcept |
获取输出张量的维度。 更多... | |
void | setOperation (FillOperation op) noexcept |
设置层的填充操作。 更多... | |
FillOperation | getOperation () const noexcept |
获取层的填充操作。 更多... | |
void | setAlpha (double alpha) noexcept |
设置 alpha 参数。 更多... | |
double | getAlpha () const noexcept |
获取 alpha 参数的值。 更多... | |
void | setBeta (double beta) noexcept |
设置 beta 参数。 更多... | |
double | getBeta () const noexcept |
获取 beta 参数的值。 更多... | |
void | setAlphaInt64 (int64_t alpha) noexcept |
使用 int64 数据类型设置 alpha 参数。 更多... | |
int64_t | getAlphaInt64 () const noexcept |
获取使用 int64 数据类型的 alpha 参数值。 更多... | |
void | setBetaInt64 (int64_t beta) noexcept |
使用 int64 数据类型设置 beta 参数。 更多... | |
int64_t | getBetaInt64 () const noexcept |
获取使用 int64 数据类型的 beta 参数值。 更多... | |
bool | isAlphaBetaInt64 () const noexcept |
如果 alpha/beta 的类型为 int64,则返回 true;如果类型为 double,则返回 false。 更多... | |
void | setToType (DataType toType) noexcept |
设置填充层输出类型。 更多... | |
DataType | getToType () const noexcept |
获取填充层输出类型。 更多... | |
void | setInput (int32_t index, ITensor &tensor) noexcept |
使用特定的张量替换此层的输入。 更多... | |
![]() | |
LayerType | getType () const noexcept |
返回层的类型。 更多... | |
void | setName (char const *name) noexcept |
设置层的名称。 更多... | |
char const * | getName () const noexcept |
返回层的名称。 更多... | |
int32_t | getNbInputs () const noexcept |
获取层的输入数量。 更多... | |
ITensor * | getInput (int32_t index) const noexcept |
获取与给定索引对应的层输入。 更多... | |
int32_t | getNbOutputs () const noexcept |
获取层的输出数量。 更多... | |
ITensor * | getOutput (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 | ~IFillLayer () noexcept=default |
![]() | |
virtual | ~ILayer () noexcept=default |
![]() | |
INoCopy ()=default | |
virtual | ~INoCopy ()=default |
INoCopy (INoCopy const &other)=delete | |
INoCopy & | operator= (INoCopy const &other)=delete |
INoCopy (INoCopy &&other)=delete | |
INoCopy & | operator= (INoCopy &&other)=delete |
受保护属性 | |
apiv::VFillLayer * | mImpl |
![]() | |
apiv::VLayer * | mLayer |
根据指定的模式生成张量。
填充层根据 FillMode 指定的模式,生成一个张量,其值从随机分布或索引的仿射函数中抽取。
当最初将 IFillLayer 添加到网络时,其所有参数都是静态的。每个参数都可以通过设置相应的输入来更改为动态。即使输入是 IConstantLayer 的输出,参数也被认为是动态的。每个参数的输入是
参数“维度”描述了输出的形状。如果提供了“维度”输入,则它必须是 Int32 或 Int64 类型的 1D 张量,其长度可通过常量折叠计算得出。
Alpha 和 Beta 的含义取决于模式,如 IFillLayer::setAlpha()、IFillLayer::setBeta() 和 IFillLayer::setInput() 中所述。参数 Alpha 和 Beta 必须都是静态的或都是动态的。
如果满足以下限制,IFillLayer 可以生成形状张量
|
protectedvirtualdefaultnoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
获取层的填充操作。
|
inlinenoexcept |
获取填充层输出类型。
|
inlinenoexcept |
如果 alpha/beta 的类型为 int64,则返回 true;如果类型为 double,则返回 false。
|
inlinenoexcept |
设置 alpha 参数。
alpha | 对于每个运算符,含义都不同 |
操作 | 用法 kLINSPACE | 起始值,默认为 0.0;kRANDOM_UNIFORM | 最小值,默认为 0.0;kRANDOM_NORMAL | 正态分布的均值,默认为 0.0;
如果输入 1 存在,则此方法将其重置为空。
|
inlinenoexcept |
使用 int64 数据类型设置 alpha 参数。
alpha | 对于每个运算符,含义都不同 |
操作 | 用法 kLINSPACE | 起始值,默认为 0;kRANDOM_UNIFORM | 最小值,默认为 0;kRANDOM_NORMAL | 正态分布的均值,默认为 0;
如果之前使用第三个输入创建了此层,则此方法会将该输入重置为空。
|
inlinenoexcept |
设置 beta 参数。
beta | 对于每个运算符,含义都不同 |
操作 | 用法 kLINSPACE | delta 值,默认为 1.0;kRANDOM_UNIFORM | 最大值,默认为 1.0;kRANDOM_NORMAL | 正态分布的标准差,默认为 1.0;
如果输入 2 存在,则此方法将其重置为空。
|
inlinenoexcept |
使用 int64 数据类型设置 beta 参数。
beta | 对于每个运算符,含义都不同 |
操作 | 用法 kLINSPACE | delta 值,默认为 1;kRANDOM_UNIFORM | 最大值,默认为 1;kRANDOM_NORMAL | 正态分布的标准差,默认为 1;
如果之前使用第三个输入创建了此层,则此方法会将该输入重置为空。
|
inlinenoexcept |
|
inlinenoexcept |
使用特定的张量替换此层的输入。
index | 要设置的输入的索引。 |
tensor | 新的输入张量 |
这三个输入对应于 IFillLayer 的这些 setter
以下描述为输入提供了更直观的名称。
kLINSPACE 的索引为
kRANDOM_UNIFORM 的索引为
kRANDOM_NORMAL 的索引为
使用相应的 setter 会将输入重置为空。
如果输入 1 或 2 中任何一个非空,则两者都必须非空且具有相同的数据类型。
如果为大于或等于 getNbInputs() 的索引调用此函数,则之后 getNbInputs() 返回 index + 1,并且任何缺失的中间输入都设置为空。
|
inlinenoexcept |
设置层的填充操作。
|
inlinenoexcept |
设置填充层输出类型。
toType | 输出张量的 DataType。 |
设置填充层的输出类型。有效值为 DataType::kFLOAT、DataType::kINT32 和 DataType::kINT64。如果网络是强类型的,则必须使用 setToType 来设置输出类型,并且使用 setOutputType 是错误的。否则,传递给 setOutputType 和 setToType 的类型必须相同。
|
protected |
Copyright © 2024 NVIDIA Corporation
隐私政策 | 管理我的隐私 | 请勿出售或分享我的数据 | 服务条款 | 无障碍访问 | 公司政策 | 产品安全 | 联系我们