Skip to content

Commit 5d30507

Browse files
committed
parallel-do should not merge the gradient of parameter witch set stop_gradient=True
1 parent f054867 commit 5d30507

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

python/paddle/fluid/layers/control_flow.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,8 @@ def get_parameters(self):
294294

295295
params = list(set(params))
296296

297-
return [parent_block.var(name) for name in params]
297+
param_list = [parent_block.var(name) for name in params]
298+
return filter(lambda param: param.stop_gradient is False, param_list)
298299

299300
def complete_op(self):
300301
main_program = self.helper.main_program

0 commit comments

Comments
 (0)