未验证 提交 8db6d221 编写于 作者: H Haipeng Wang 提交者: GitHub

support saving model defined parameters without add scale_op (#36119)

* add scale_op in model save step is not necessary, just fix the prune method to support static graph and inplace op

* fix jit.save, no need to add scale_op to each outputvar anymore.
fix prune_with_input, now it supports inplace op

* temporarily disable test_trt_dynamic_shape.TRTDynamicShapeOutOfBound2Test

* allow user to export parameters defined in model
上级 23ccbcb1
......@@ -5074,11 +5074,7 @@ class Program(object):
else:
target_op = op
if target_op is None:
raise ValueError(
"The target variable used for pruning should have an "
"associated operator that generates it.")
else:
if target_op is not None:
targets_idx.append([target_op.block.idx, target_op.idx])
else:
targets_idx.append([t.block.idx, t.idx])
......
......@@ -1426,7 +1426,8 @@ def save_inference_model(dirname,
main_program.global_block().create_var(
name=target_v.name,
shape=target_v.shape,
dtype=target_v.dtype)
dtype=target_v.dtype,
persistable=target_v.persistable)
prepend_feed_ops(main_program, feeded_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.
先完成此消息的编辑!
想要评论请 注册