产品 |
是否支持 |
---|---|
√ |
|
√ |
|
√ |
|
√ |
量化数据均衡预处理接口,将输入的待量化的图结构按照给定的量化配置文件进行训练后量化预处理,在传入的图结构中插入均衡量化算子,生成均衡量化因子记录文件record_file,返回修改后的ONNX校准模型。
1 | quantize_preprocess(config_file, record_file, model_file, modified_onnx_file) |
参数名 |
输入/输出 |
说明 |
---|---|---|
config_file |
输入 |
含义:用户生成的量化配置文件,用于指定模型network中量化层的配置情况。 数据类型:string |
record_file |
输入 |
含义:均衡量化因子记录文件路径及名称。 数据类型:string |
model_file |
输入 |
含义:用户原始onnx模型文件或者通过create_quant_config生成的updated模型。 数据类型:string |
modified_onnx_file |
输入 |
含义:文件名,用于存储待执行数据量化的ONNX校准模型。 数据类型:string |
无
1 2 3 4 5 6 7 8 9 10 11 | import amct_onnx as amct model_file = "resnet101.onnx" tensor_balance_factor_record_file = os.path.join(TMP, 'tensor_balance_factor_record.txt') modified_model = os.path.join(TMP, 'modified_model.onnx') config_file="./configs/config.json" # 插入量化API amct.quantize_preprocess(config_file, tensor_balance_factor_record_file, model_file, modified_model) |