Skip to content

Commit f7fbef1

Browse files
authored
Merge pull request #10027 from typhoonzero/fix_transpiler_last_empty_block
Remove redundent pserver block
2 parents 60e0d1a + e69de09 commit f7fbef1

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

python/paddle/fluid/distribute_transpiler.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -420,13 +420,14 @@ def __append_optimize_op__(op, block):
420420

421421
# append op to the current block
422422
per_opt_block = append_block
423-
for _, opt_op in enumerate(opt_op_on_pserver):
423+
for idx, opt_op in enumerate(opt_op_on_pserver):
424424
for _, op in enumerate(self.optimize_ops):
425425
# optimizer is connected to itself
426426
if ufind.is_connected(op, opt_op) and \
427427
op not in global_ops:
428428
__append_optimize_op__(op, per_opt_block)
429-
per_opt_block = pserver_program.create_block(append_block.idx)
429+
if idx == len(opt_op_on_pserver) - 1 and global_ops:
430+
per_opt_block = pserver_program.create_block(append_block.idx)
430431

431432
# append global ops
432433
for glb_op in global_ops:

0 commit comments

Comments
 (0)