TensorRT 10.8.0
|
更新引擎中的权重。 更多...
#include <NvInferRuntime.h>
公共成员函数 | |
virtual | ~IRefitter () noexcept=default |
bool | setWeights (char const *layerName, WeightsRole role, Weights weights) noexcept |
为给定名称的层指定新权重。成功返回 true,如果新权重被拒绝则返回 false。拒绝的可能原因: 更多... | |
bool | refitCudaEngine () noexcept |
重拟合关联的引擎。 更多... | |
int32_t | getMissing (int32_t size, char const **layerNames, WeightsRole *roles) noexcept |
获取缺失权重的描述。 更多... | |
int32_t | getAll (int32_t size, char const **layerNames, WeightsRole *roles) noexcept |
获取可以重拟合的所有权重的描述。 更多... | |
TRT_DEPRECATED bool | setDynamicRange (char const *tensorName, float min, float max) noexcept |
TRT_DEPRECATED float | getDynamicRangeMin (char const *tensorName) const noexcept |
获取动态范围的最小值。 更多... | |
TRT_DEPRECATED float | getDynamicRangeMax (char const *tensorName) const noexcept |
获取动态范围的最大值。 更多... | |
TRT_DEPRECATED int32_t | getTensorsWithDynamicRange (int32_t size, char const **tensorNames) const noexcept |
获取所有具有可重拟合动态范围的张量的名称。 更多... | |
void | setErrorRecorder (IErrorRecorder *recorder) noexcept |
为此接口设置 ErrorRecorder。 更多... | |
IErrorRecorder * | getErrorRecorder () const noexcept |
获取分配给此接口的 ErrorRecorder。 更多... | |
bool | setNamedWeights (char const *name, Weights weights) noexcept |
指定给定名称的新权重。 更多... | |
int32_t | getMissingWeights (int32_t size, char const **weightsNames) noexcept |
获取缺失权重的名称。 更多... | |
int32_t | getAllWeights (int32_t size, char const **weightsNames) noexcept |
获取可以重拟合的所有权重的名称。 更多... | |
ILogger * | getLogger () const noexcept |
获取创建 refitter 时使用的 logger 更多... | |
bool | setMaxThreads (int32_t maxThreads) noexcept |
设置最大线程数。 更多... | |
int32_t | getMaxThreads () const noexcept |
获取 refitter 可以使用的最大线程数。 更多... | |
bool | setNamedWeights (char const *name, Weights weights, TensorLocation location) noexcept |
在给定名称的指定设备上指定新权重。 更多... | |
Weights | getNamedWeights (char const *weightsName) const noexcept |
获取与给定名称关联的权重。 更多... | |
TensorLocation | getWeightsLocation (char const *weightsName) const noexcept |
获取与给定名称关联的权重的location。 更多... | |
bool | unsetNamedWeights (char const *weightsName) noexcept |
取消设置与给定名称关联的权重。 更多... | |
void | setWeightsValidation (bool weightsValidation) noexcept |
设置在重拟合期间是否验证权重。 更多... | |
bool | getWeightsValidation () const noexcept |
获取在重拟合期间是否验证权重值。 更多... | |
bool | refitCudaEngineAsync (cudaStream_t stream) noexcept |
在给定流上排队关联引擎的权重重拟合。 更多... | |
Weights | getWeightsPrototype (char const *weightsName) const noexcept |
获取与给定名称关联的 Weights 原型。 更多... | |
保护属性 | |
apiv::VRefitter * | mImpl |
附加的继承成员 | |
![]() | |
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 |
更新引擎中的权重。
|
virtualdefaultnoexcept |
|
inlinenoexcept |
获取可以重拟合的所有权重的描述。
size | 可以安全写入非空 layerNames 或 roles 的项目数。 |
layerNames | 写入层名称的位置。 |
roles | 写入权重角色的位置。 |
如果 layerNames!=nullptr,则每个写入的指针都指向被重拟合的引擎拥有的字符串,并且在引擎销毁时变为无效。
|
inlinenoexcept |
获取可以重拟合的所有权重的名称。
size | 可以安全写入的权重名称的数量。 |
weightsNames | 要更新的权重的名称,或用于未命名权重的 nullptr。 |
如果 layerNames!=nullptr,则每个写入的指针都指向被重拟合的引擎拥有的字符串,并且在引擎销毁时变为无效。
|
inlinenoexcept |
获取动态范围的最大值。
如果从未设置动态范围,则返回校准期间计算的最大值。
|
inlinenoexcept |
获取动态范围的最小值。
如果从未设置动态范围,则返回校准期间计算的最小值。
|
inlinenoexcept |
获取分配给此接口的 ErrorRecorder。
检索给定类已分配的错误记录器对象。如果尚未设置错误处理程序,则将返回 nullptr。
|
inlinenoexcept |
获取创建 refitter 时使用的 logger
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
获取与给定名称关联的权重。
weightsName | 要重拟合的权重的名称。 |
如果从未设置权重,则返回空权重并将错误报告给 refitter errorRecorder。
|
inlinenoexcept |
|
inlinenoexcept |
获取与给定名称关联的权重的 location。
weightsName | 要重拟合的权重的名称。 |
如果从未设置权重,则返回 TensorLocation::kHOST 并将错误报告给 refitter errorRecorder。
|
inlinenoexcept |
|
inlinenoexcept |
获取在重拟合期间是否验证权重值。
|
inlinenoexcept |
重拟合关联的引擎。
如果引擎有待处理的排队工作,则行为未定义。CPU 或 GPU 上提供的权重可以在 refitCudaEngine 返回后取消设置并释放,或更新。
与引擎关联的 IExecutionContexts 在之后仍然有效使用。无需为多次重拟合调用重复设置相同的权重,因为可以直接更新权重内存。
|
inlinenoexcept |
在给定流上排队关联引擎的权重重拟合。
stream | 用于排队权重更新任务的流。 |
如果引擎在与提供的流不同的流上有待处理的排队工作,则行为未定义。CPU 上提供的权重可以在 refitCudaEngineAsync 返回后取消设置并释放,或更新。GPU 上提供的权重的释放或更新可以在 refitCudaEngineAsync 返回后在同一流上排队。
与引擎关联的 IExecutionContexts 在之后仍然有效使用。无需为多次重拟合调用重复设置相同的权重,因为可以直接更新权重内存。权重更新任务应使用与重拟合调用相同的流。
|
inlinenoexcept |
|
inlinenoexcept |
为此接口设置 ErrorRecorder。
将 ErrorRecorder 分配给此接口。ErrorRecorder 将跟踪执行期间的所有错误。此函数将至少调用一次已注册 ErrorRecorder 的 incRefCount。将 recorder 设置为 nullptr 将取消注册接口的记录器,如果已注册记录器,则会导致调用 decRefCount。
如果未设置错误记录器,则消息将发送到全局日志流。
recorder | 要向此接口注册的错误记录器。 |
|
inlinenoexcept |
设置最大线程数。
maxThreads | refitter 可以使用的最大线程数。 |
默认值为 1,包括当前线程。大于 1 的值允许 TensorRT 使用多线程算法。小于 1 的值会触发 kINVALID_ARGUMENT 错误。
|
inlinenoexcept |
指定给定名称的新权重。
name | 要重拟合的权重的名称。 |
weights | 要与名称关联的新权重。 |
成功返回 true,如果新权重被拒绝则返回 false。拒绝的可能原因包括
在方法 refitCudaEngine 或 refitCudaEngineAsync 返回之前修改权重将导致未定义的行为。
|
inlinenoexcept |
在给定名称的指定设备上指定新权重。
name | 要重拟合的权重的名称。 |
weights | 指定设备上的新权重。 |
location | 新权重的 location(主机 vs. 设备)。 |
允许在 CPU 上提供一些权重,在 GPU 上提供另一些权重。在方法 refitCudaEngine() 或 refitCudaEngineAsync() 完成之前修改权重将导致未定义的行为。
|
inlinenoexcept |
为给定名称的层指定新权重。成功返回 true,如果新权重被拒绝则返回 false。拒绝的可能原因包括
在方法 refitCudaEngine 或 refitCudaEngineAsync 返回之前修改权重将导致未定义的行为。
|
inlinenoexcept |
设置在重拟合期间是否验证权重。
weightsValidation | 指示在重拟合期间是否验证权重。 |
设置为 true 时,TensorRT 将在 refit 调用中验证 FP32 到 FP16/BF16 权重转换或稀疏化权重期间的权重。如果提供的权重对于某些权重转换不正确,TensorRT 将发出警告并继续进行次要问题的转换(例如缩小转换期间的溢出),或者发出错误并停止严重问题的重拟合过程(例如稀疏化密集权重)。默认情况下,该标志为 true。将该标志设置为 false 可以提高重拟合性能。
|
inlinenoexcept |
取消设置与给定名称关联的权重。
weightsName | 要重拟合的权重的名称。 |
在释放权重之前取消设置权重。
|
protected |
版权所有 © 2024 NVIDIA Corporation
隐私政策 | 管理我的隐私 | 请勿出售或分享我的数据 | 服务条款 | 辅助功能 | 公司政策 | 产品安全 | 联系我们