Skip to content

Commit 5f168af

Browse files
authored
allow user to export parameters defined in model (#36132)
1 parent b171aab commit 5f168af

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

python/paddle/fluid/framework.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5074,11 +5074,7 @@ def _prune_with_input(self, feeded_var_names, targets):
50745074
else:
50755075
target_op = op
50765076

5077-
if target_op is None:
5078-
raise ValueError(
5079-
"The target variable used for pruning should have an "
5080-
"associated operator that generates it.")
5081-
else:
5077+
if target_op is not None:
50825078
targets_idx.append([target_op.block.idx, target_op.idx])
50835079
else:
50845080
targets_idx.append([t.block.idx, t.idx])

python/paddle/fluid/io.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1426,7 +1426,8 @@ def save_inference_model(dirname,
14261426
main_program.global_block().create_var(
14271427
name=target_v.name,
14281428
shape=target_v.shape,
1429-
dtype=target_v.dtype)
1429+
dtype=target_v.dtype,
1430+
persistable=target_v.persistable)
14301431

14311432
prepend_feed_ops(main_program, feeded_var_names)
14321433
append_fetch_ops(main_program, fetch_var_names)

0 commit comments

Comments
 (0)