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
Why SparseGaussianAdam do not support group["params"] multi elements, such us torch.optim.Adam ?
class SparseGaussianAdam(torch.optim.Adam):
def __init__(self, params, lr, eps):
super().__init__(params=params, lr=lr, eps=eps)
@torch.no_grad()
def step(self, visibility, N):
for group in self.param_groups:
lr = group["lr"]
eps = group["eps"]
assert len(group["params"]) == 1, "more than one tensor in group"
param = group["params"][0]
if param.grad is None:
continue
....
class Adam(Optimizer):
@_use_grad_for_differentiable
def step(self, closure=None, *, grad_scaler=None):
...
for p in group['params']:
if p.grad is not None:
params_with_grad.append(p)
if p.grad.is_sparse:
raise RuntimeError('Adam does not support sparse gradients, please consider SparseAdam instead')
grads.append(p.grad)
...
state_steps.append(state['step'])
The text was updated successfully, but these errors were encountered:
Why SparseGaussianAdam do not support
group["params"]
multi elements, such ustorch.optim.Adam
?The text was updated successfully, but these errors were encountered: