TensorRT 10.8.0
|
表示恒等函数的层。 更多...
#include <NvInfer.h>
受保护的成员函数 | |
virtual | ~IIdentityLayer () 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::VIdentityLayer * | mImpl |
![]() | |
apiv::VLayer * | mLayer |
附加的继承成员 | |
![]() | |
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 |
获取层的元数据。 更多... | |
表示恒等函数的层。
如果通过 setOutputType 显式指定了输出类型,则 IIdentityLayer 可用于从一种类型转换为另一种类型。除了相同类型之间的转换(例如 kFLOAT -> kFLOAT),唯一有效的转换是
(kFLOAT | kHALF | kINT32 | kBOOL) -> (kFLOAT | kHALF | kINT32 | kBOOL) (kFLOAT | kHALF) -> kUINT8 kUINT8 -> (kFLOAT | kHALF)
如果输出张量是网络输出,则也会隐式发生转换,而无需调用 setOutputType。
如果两种类型相同,或者都属于 {kFLOAT, kHALF},则它们是兼容的。TensorRT 8.4 之后,不兼容类型之间的隐式转换(即不使用 setOutputType)被认为是错误的,但在 TensorRT 8.x 版本中为了 API 兼容性而保留。从 TensorRT 10.0 开始,如果网络输出张量类型与层输出类型不兼容,则会报错。例如,不允许从 kFLOAT 到 kINT32 的隐式转换。使用 setOutputType(DataType::kINT32) 显式地将 kFLOAT 转换为 kINT32。
|
protectedvirtualdefaultnoexcept |
|
protected |
版权所有 © 2024 NVIDIA Corporation
隐私政策 | 管理我的隐私 | 请勿出售或分享我的数据 | 服务条款 | 辅助功能 | 公司政策 | 产品安全 | 联系我们