We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6bd8afc commit ba85681Copy full SHA for ba85681
pytorch_optimizer/optimizer/nero.py
@@ -92,7 +92,7 @@ def step(self, closure: CLOSURE = None) -> LOSS:
92
bias_correction: float = 1.0 - self.beta ** state['step']
93
94
grad_normed = grad / ((exp_avg_sq / bias_correction).sqrt() + self.eps)
95
- grad_normed[torch.isnan(grad_normed)] = 0.0
+ torch.nan_to_num(grad_normed, nan=0.0, out=grad_normed)
96
97
p.sub_(group['lr'] * state['scale'] * grad_normed)
98
0 commit comments