未验证 提交 5f168af7 编写于 作者: H Haipeng Wang 提交者: GitHub

allow user to export parameters defined in model (#36132)

上级 b171aaba
...@@ -5074,11 +5074,7 @@ class Program(object): ...@@ -5074,11 +5074,7 @@ class Program(object):
else: else:
target_op = op target_op = op
if target_op is None: if target_op is not None:
raise ValueError(
"The target variable used for pruning should have an "
"associated operator that generates it.")
else:
targets_idx.append([target_op.block.idx, target_op.idx]) targets_idx.append([target_op.block.idx, target_op.idx])
else: else:
targets_idx.append([t.block.idx, t.idx]) targets_idx.append([t.block.idx, t.idx])
......
...@@ -1426,7 +1426,8 @@ def save_inference_model(dirname, ...@@ -1426,7 +1426,8 @@ def save_inference_model(dirname,
main_program.global_block().create_var( main_program.global_block().create_var(
name=target_v.name, name=target_v.name,
shape=target_v.shape, shape=target_v.shape,
dtype=target_v.dtype) dtype=target_v.dtype,
persistable=target_v.persistable)
prepend_feed_ops(main_program, feeded_var_names) prepend_feed_ops(main_program, feeded_var_names)
append_fetch_ops(main_program, fetch_var_names) append_fetch_ops(main_program, fetch_var_names)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册