IInt8Calibrator¶
-
class
tensorrt.
IInt8Calibrator
(self: tensorrt.tensorrt.IInt8Calibrator) → None¶ Application-implemented interface for calibration. Calibration is a step performed by the builder when deciding suitable scale factors for 8-bit inference. It must also provide a method for retrieving representative images which the calibration process can use to examine the distribution of activations. It may optionally implement a method for caching the calibration result for reuse on subsequent runs.
Variables: - batch_size –
int
The batch size used for calibration batches. - algorithm –
CalibrationAlgoType
The algorithm used by this calibrator.
-
get_algorithm
(self: tensorrt.tensorrt.IInt8Calibrator) → tensorrt.tensorrt.CalibrationAlgoType¶
-
get_batch
(self: tensorrt.tensorrt.IInt8Calibrator, bindings: List[capsule], names: List[str]) → object¶ Get a batch of input for calibration. The batch size of the input must match the batch size returned by
batch_size()
.Parameters: - bindings – An array of device memory objects that must be set to the memory containing each network input data.
- names – The names of the network inputs for each object in the bindings array.
Returns: False if there are no more batches for calibration.
-
get_batch_size
(self: tensorrt.tensorrt.IInt8Calibrator) → int¶
-
read_calibration_cache
(self: tensorrt.tensorrt.IInt8Calibrator, length: int) → capsule¶ Load a calibration cache.
Calibration is potentially expensive, so it can be useful to generate the calibration data once, then use it on subsequent builds of the network. The cache includes the regression cutoff and quantile values used to generate it, and will not be used if these do not batch the settings of the current calibrator. However, the network should also be recalibrated if its structure changes, or the input data set changes, and it is the responsibility of the application to ensure this.
Parameters: length – The length of the cached data, that should be set by the called function. If there is no data, this should be zero. Returns: A cache object or None if there is no data.
-
write_calibration_cache
(self: tensorrt.tensorrt.IInt8Calibrator, data: capsule, length: int) → None¶ Save a calibration cache.
Parameters: - data – The data to cache.
- length – The length in bytes of the data to cache.
- batch_size –