Here is the code I’m trying to run on Google Colab:
import torch
class Model(torch.nn.Module):
def __init__(self):
super(Model, self).__init__()
self.U = torch.nn.Embedding(12, 8, sparse=True)
self.V = torch.nn.Embedding(18, 8, sparse=True)
def forward(self):
# to be implemented
pass
model = Model()
optimizer = torch.optim.SparseAdam(model.parameters(), lr=2e-3)
and I get a ValueError. However, printing list(model.parameters())
shows that the parameters clearly exist. What could be the issue here?