未验证 提交 435f942b 编写于 作者: Y Yanzhan Yang 提交者: GitHub

fix persistable test=develop (#2191)

上级 da55f674
...@@ -26,6 +26,7 @@ quantification = False ...@@ -26,6 +26,7 @@ quantification = False
quantification_fold = 1000 quantification_fold = 1000
architecture = "arm-v7a" architecture = "arm-v7a"
# architecture = "arm-v8a" # architecture = "arm-v8a"
correct_persistable = False
np.set_printoptions(linewidth=150) np.set_printoptions(linewidth=150)
...@@ -69,6 +70,18 @@ exe.run(fluid.default_startup_program()) ...@@ -69,6 +70,18 @@ exe.run(fluid.default_startup_program())
# 加载模型 # 加载模型
def load_model(model_path): def load_model(model_path):
prog, feeds, fetches = fluid.io.load_inference_model(dirname=model_path, executor=exe, model_filename="model", params_filename="params") prog, feeds, fetches = fluid.io.load_inference_model(dirname=model_path, executor=exe, model_filename="model", params_filename="params")
global correct_persistable
if correct_persistable:
ops = prog.current_block().ops
vars = prog.current_block().vars
for op in ops:
for var_name in op.output_arg_names:
if var_name == "fetch":
continue
var = vars[var_name]
if var.persistable:
pp_red("has found non-persistable output var : {}".format(var_name))
var.persistable = False
return (prog, feeds, fetches) return (prog, feeds, fetches)
prog, feeds, fetches = load_model(model_path) prog, feeds, fetches = load_model(model_path)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册