torch_tensorrt.ptq¶
- class torch_tensorrt.ptq.CacheCalibrator(*args, **kwargs)[source]¶
Bases:
object
Constructs a calibrator class in TensorRT which directly uses pre-existing cache file for calibration. :param cache_file: path to cache file. :param algo_type: choice of calibration algorithm.
- class torch_tensorrt.ptq.CalibrationAlgo(value)[source]¶
Bases:
enum.Enum
An enumeration.
- ENTROPY_CALIBRATION = <CalibrationAlgo.ENTROPY_CALIBRATION: 1>¶
- ENTROPY_CALIBRATION_2 = <CalibrationAlgo.ENTROPY_CALIBRATION_2: 2>¶
- LEGACY_CALIBRATION = <CalibrationAlgo.LEGACY_CALIBRATION: 0>¶
- MINMAX_CALIBRATION = <CalibrationAlgo.MINMAX_CALIBRATION: 3>¶
- class torch_tensorrt.ptq.DataLoaderCalibrator(*args, **kwargs)[source]¶
Bases:
object
Constructs a calibrator class in TensorRT and uses pytorch dataloader to load/preproces data which is passed during calibration. :param dataloader: an instance of pytorch dataloader which iterates through a given dataset. :param algo_type: choice of calibration algorithm. :param cache_file: path to cache file. :param use_cache: flag which enables usage of pre-existing cache. :param device: device on which calibration data is copied to.
Classes¶
- class torch_tensorrt.ptq.DataLoaderCalibrator(*args, **kwargs)[source]¶
Constructs a calibrator class in TensorRT and uses pytorch dataloader to load/preproces data which is passed during calibration. :param dataloader: an instance of pytorch dataloader which iterates through a given dataset. :param algo_type: choice of calibration algorithm. :param cache_file: path to cache file. :param use_cache: flag which enables usage of pre-existing cache. :param device: device on which calibration data is copied to.