int8
对ONNX模型执行INT8量化,并返回ONNX ModelProto。
函数
使用编译器友好的启发式方法对ONNX文件应用INT8量化。 |
- quantize(onnx_path, calibration_method='entropy', calibration_data_reader=None, calibration_cache_path=None, calibration_shapes=None, calibration_eps=['cuda:0', 'cpu', 'trt'], op_types_to_quantize=None, op_types_to_exclude=None, nodes_to_quantize=None, nodes_to_exclude=None, use_external_data_format=True, intermediate_generated_files=[], verbose=False, trt_extra_plugin_lib_paths=None, high_precision_dtype='fp32', **kwargs)
使用编译器友好的启发式方法对ONNX文件应用INT8量化。
支持对['Add', 'AveragePool', 'BatchNormalization', 'Clip', 'Conv', 'ConvTranspose', 'Gemm', 'GlobalAveragePool', 'MatMul', 'MaxPool', 'Mul']操作类型进行量化。
- Parameters:
onnx_path (str) –
calibration_method (str) –
calibration_data_reader (CalibrationDataReader) –
calibration_cache_path (str) –
calibration_shapes (str) –
calibration_eps (List[str]) –
op_types_to_quantize (List[str]) –
op_types_to_exclude (List[str]) –
nodes_to_quantize (List[str]) –
nodes_to_exclude (List[str]) –
use_external_data_format (bool) –
intermediate_generated_files (List[str]) –
verbose (bool) –
trt_extra_plugin_lib_paths (str) –
high_precision_dtype (str) –
- Return type:
ModelProto