文档
注册

init

功能说明

训练后量化接口,用于初始化AMCT,记录存储量化因子的文件,解析用户模型为图结构graph,供quantize_modelsave_model使用。

函数原型

graph = init(config_file, model_file, weights_file, scale_offset_record_file)

参数说明

参数名

输入/返回值

含义

使用限制

config_file

输入

用户生成的量化配置文件。

数据类型:string

model_file

输入

用户Caffe模型的定义文件,格式为.prototxt,与create_quant_config中的model_file保持一致

数据类型:string

使用约束:model_file中包含的用于推理的层,LayerParameter设置满足推理要求,比如BatchNorm层的use_global_stats必须设置为1。

weights_file

输入

用户训练好的Caffe模型文件,格式为.caffemodel,与create_quant_config中的weights_file保持一致

数据类型:string

scale_offset_record_file

输入

存储量化因子的文件路径,如果该路径下的文件存在,会被重写。

数据类型:string

graph

返回值

用户模型解析出来的图结构。

数据类型:工具自定义的数据结构Graph

返回值说明

graph:用户模型解析出来的图结构。

函数输出

scale_offset_record_file:存储量化因子的文件,文件如果不存在,则会被创建,否则会被清空。

重新执行量化时,该接口输出的存储量化因子文件将会被覆盖。

调用示例

1
2
3
4
5
6
from amct_caffe import init
# 初始化工具
graph = init(config_file="./configs/config.json",
             model_file="./pretrained_model/model.prototxt",
             weights_file="./pretrained_model/model.caffemodel",
             scale_offset_record_file="./recording.txt")
搜索结果
找到“0”个结果

当前产品无相关内容

未找到相关内容,请尝试其他搜索词