快捷方式

模板類 Int8CacheCalibrator

繼承關係

基類

  • private Algorithm

類文件

template<typename Algorithm>
class Int8CacheCalibrator : private Algorithm

通用的 Int8Calibrator 實現,基於指定的 TensorRT 校準演算法,僅從校準檔案中讀取資料。

模板引數

Algorithm – 類 nvinfer1::IInt8Calibrator (預設: nvinfer1::IInt8EntropyCalibrator2) - 要使用的演算法

公共函式

inline Int8CacheCalibrator(const std::string &cache_file_path)

構造一個新的 Int8CacheCalibrator 物件。

引數

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 calibrator 提供),這些緩衝區應填充每個輸入的批次資料

  • names – const char*[] - 繫結的名稱

  • nbBindings – int - 繫結數量

返回值

false

inline const void *readCalibrationCache(size_t &length) noexcept override

讀取校準快取。

如何從校準快取中讀取,僅在使用 use_cache 設定時啟用

引數

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*

文件

訪問 PyTorch 的全面開發者文件

檢視文件

教程

獲取面向初學者和高階開發者的深度教程

檢視教程

資源

查詢開發資源並獲得問題解答

檢視資源