Skip to content

Commit f8d0d84

Browse files
committed
fix multi card
1 parent 5d30507 commit f8d0d84

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

python/paddle/fluid/backward.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,10 @@ def _callback_lookup_(op):
220220
:return: callback function
221221
"""
222222
if op.type == 'parallel_do' and op.attr('use_nccl'):
223+
all_vars = op.block.vars
223224
param_names = set(op.input('parameters'))
225+
param_names = filter(lambda name: all_vars[name].stop_gradient is False,
226+
param_names)
224227
param_grad_names = [n + "@GRAD" for n in param_names]
225228

226229
class ParallelDoCallBack(object):

python/paddle/fluid/layers/control_flow.py

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

295295
params = list(set(params))
296296

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

300299
def complete_op(self):
301300
main_program = self.helper.main_program

0 commit comments

Comments
 (0)