Template Class Int8CacheCalibrator¶
定義於 檔案 ptq.h
繼承關係¶
基底類型¶
private Algorithm
類別文件¶
-
template<typename Algorithm>
class Int8CacheCalibrator : private Algorithm¶ 基於指定的 TensorRT 校正演算法的通用 Int8Calibrator 實作,該實作僅從校正檔案讀取。
- 樣板參數
Algorithm – class nvinfer1::IInt8Calibrator (預設值:nvinfer1::IInt8EntropyCalibrator2) - 要使用的演算法
公用函式
-
inline Int8CacheCalibrator(const std::string &cache_file_path)¶
建構新的 Int 8 快取校正器物件。
- 參數
cache_file_path –
-
inline int getBatchSize() const noexcept override¶
取得下一個批次的批次大小 (由於 TRT 和明確批次的問題,永遠為 1)
- 傳回
int
-
inline bool getBatch(void *bindings[], const char *names[], int nbBindings) noexcept override¶
取得下一個批次。
未使用,永遠傳回 false
- 參數
bindings – void*[] - 綁定指標陣列 (從 TensorRT 校正器饋入),這些緩衝區應填入每個輸入的批次資料
names – const char*[] - 綁定的名稱
nbBindings – int - 綁定數量
- 傳回
false
-
inline const void *readCalibrationCache(size_t &length) noexcept override¶
讀取校正快取。
如何從校正快取讀取,僅在使用快取時啟用
- 參數
length –
- 傳回
const void* - 快取資料的指標
-
inline void writeCalibrationCache(const void *cache, size_t length) noexcept override¶
寫入校正快取。
將 TensorRT 提供的校正快取寫入指定的檔案
- 參數
cache – const void* - 快取資料
length – size_t - 快取長度
-
inline operator nvinfer1::IInt8Calibrator*()¶
運算子轉換為 nvinfer1::IInt8Calibrator*
方便的函式,可轉換為 IInt8Calibrator*,以便輕鬆指派給 CompileSpec 中的 ptq_calibrator 欄位
- 傳回
nvinfer1::IInt8Calibrator*