Skip to content

Commit

Permalink
style: fix RUF021
Browse files Browse the repository at this point in the history
  • Loading branch information
kozistr committed Nov 23, 2024
1 parent e53d049 commit f82fc9d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pytorch_optimizer/optimizer/lomo.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def func(x: Any) -> Any:
if not p.requires_grad or p.grad is None:
continue

if self.loss_scaler and self.loss_scaler.has_overflow_serial or has_overflow(p.grad):
if (self.loss_scaler and self.loss_scaler.has_overflow_serial) or has_overflow(p.grad):
p.grad = None
self.loss_scaler.has_overflow_serial = True
break
Expand Down Expand Up @@ -119,7 +119,7 @@ def func(x: torch.Tensor) -> torch.Tensor:

all_reduce(p.grad, op=ReduceOp.AVG, async_op=False)

if self.loss_scaler and self.loss_scaler.has_overflow_serial or has_overflow(p.grad):
if (self.loss_scaler and self.loss_scaler.has_overflow_serial) or has_overflow(p.grad):
p.grad = None
self.loss_scaler.has_overflow_serial = True
break
Expand Down

0 comments on commit f82fc9d

Please sign in to comment.