save_inference_model
将模型及其参数保存到指定的路径。例如,path_prefix="/path/to/modelname"
,在调用 save_inference_model(path_prefix, feed_vars, fetch_vars, executor)
之后,你可以在 “/path/to” 目录下找到两个文件,分别是 “modelname.pdmodel” 和 “modelname.pdiparams”,前者表示序列化之后的模型文件,后者表示序列化之后的参数文件。
参数:
path_prefix (str) – 要保存到的目录 + 模型名称(不包含后缀)。
executor (Executor) – 用于保存预测模型的
executor
,详见 。kwargs - 支持的 key 包括 ‘program’。(注意:kwargs 主要是用来做反向兼容的)。
抛出异常:
– 若
feed_vars
不是Variable
或Variable
类型列表,则抛出异常。– 若
fetch_vars
不是Variable
或Variable
类型列表,则抛出异常。