Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions python/paddle/distributed/auto_parallel/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -2324,7 +2324,12 @@ def unscale_method(self, optimizer):
for group in optimizer._param_groups:
for param in group['params']:
tgt_grad = param._grad_ivar()
if tgt_grad is not None:
if (
tgt_grad is not None
and getattr(
tgt_grad, '_is_initialized', lambda: False
)()
):
if src_mesh is None:
src_mesh = tgt_grad.process_mesh
if (
Expand All @@ -2341,7 +2346,10 @@ def unscale_method(self, optimizer):
else:
for param in optimizer._parameter_list:
tgt_grad = param._grad_ivar()
if tgt_grad is not None:
if (
tgt_grad is not None
and getattr(tgt_grad, '_is_initialized', lambda: False)()
):
if src_mesh is None:
src_mesh = tgt_grad.process_mesh
if (
Expand Down