ITimingCache¶
- class tensorrt.ITimingCache¶
用于处理从构建器收集的策略计时信息的类。
- combine(self: tensorrt.tensorrt.ITimingCache, input_cache: tensorrt.tensorrt.ITimingCache, ignore_mismatch: bool) bool ¶
将输入计时缓存合并到本地实例。
将输入缓存中的条目追加到本地缓存。冲突的条目将被跳过。输入缓存必须由完全相同版本的 TensorRT 构建生成,否则合并将被跳过并返回 false。如果合并从不同设备创建的计时缓存,则
bool(ignore_mismatch) == True
。- 参数:
input_cache – 输入计时缓存
ignore_mismatch – 是否允许缓存验证标头不匹配
- 返回值:
一个 bool 值,指示合并操作是否成功完成。
- query(self: tensorrt.tensorrt.ITimingCache, key: tensorrt.tensorrt.TimingCacheKey) tensorrt.tensorrt.TimingCacheValue ¶
查询缓存条目中的值。
如果键存在,则写出值,否则返回无效值。
- 参数:
key – 查询键。
- 缓存:
如果键存在则返回值,否则为无效值。
:returns 一个
TimingCacheValue
对象。
- queryKeys(self: tensorrt.tensorrt.ITimingCache) List[tensorrt.tensorrt.TimingCacheKey] ¶
从计时缓存查询缓存键。
如果发生错误,将引发 RuntimeError。
:returns 包含缓存键的列表。
- reset(self: tensorrt.tensorrt.ITimingCache) bool ¶
清空计时缓存
- 返回值:
一个 bool 值,指示重置操作是否成功完成。
- serialize(self: tensorrt.tensorrt.ITimingCache) tensorrt.tensorrt.IHostMemory ¶
将计时缓存序列化为
IHostMemory
对象。- 返回值:
一个
IHostMemory
对象,其中包含序列化的计时缓存。
- update(self: tensorrt.tensorrt.ITimingCache, key: tensorrt.tensorrt.TimingCacheKey, value: tensorrt.tensorrt.TimingCacheValue) bool ¶
更新缓存条目中的值。
更新给定缓存键的值。如果键不存在,则返回 False。如果键存在且新的策略计时为 NaN,则删除缓存条目并返回 True。如果策略计时不是 NaN 且新值有效,则覆盖缓存值并返回 True。当新值无效时返回 False。如果此层无法使用新的策略,则在构建下一个引擎时将报告构建错误。
- 参数:
key – 要更新的条目的键。
value – 新的缓存值。
:returns 如果更新成功,则返回 True,否则返回 False。