Skip to content

Commit 09331b0

Browse files
authored
Revert "[AutoParallel] use inplace multiply in grad_clip (PaddlePaddle#71421)"
This reverts commit 9fee57d.
1 parent 2ffcf1d commit 09331b0

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

python/paddle/nn/clip.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -840,12 +840,8 @@ def async_add_n(var_list):
840840
clip_input = paddle.distributed.reshard(
841841
clip_input, g.process_mesh, clip_input.placements
842842
)
843-
if g.is_dist() or g.is_dense():
844-
g.multiply_(clip_input)
845-
params_and_grads.append((p, g))
846-
else:
847-
new_grad = paddle.multiply(g, clip_input)
848-
params_and_grads.append((p, new_grad))
843+
new_grad = paddle.multiply(g, clip_input)
844+
params_and_grads.append((p, new_grad))
849845
else:
850846
params_and_grads.append((p, g))
851847

0 commit comments

Comments
 (0)