You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import torch
from torch.optim import Adam
m = torch.arange(5.0, requires_grad=True)
optimizer = Adam([m], lr=0.1)
f = 1 / m
f[m == 0] = 1.0
loss = torch.mean(f**2)
optimizer.zero_grad()
loss.backward()
optimizer.step()
The following code:
will cause the tensor m to evaluate to:
The text was updated successfully, but these errors were encountered: