The following code is from lession 5.
I don’t understand why forward function that returns of type [torch.cuda.FloatTensor of size 32 (GPU 0)]
based on the input mini batch users, and movies size 64. It contains only 32 distinct values. I am not sure what the value represents.
I am trying to visualize in the callab_filter.xlsx. If I choose 32 users, and 32 movies, I will get cells size 32 x 32. How does the forward function related to the spreadsheet? Shouldn’t the output be Tensor of size 32 x 32 in the forward function?
class EmbeddingDot(nn.Module):
def __init__(self, n_users, n_movies):
super().__init__()
self.u = nn.Embedding(n_users, n_factors)
self.m = nn.Embedding(n_movies, n_factors)
self.u.weight.data.uniform_(0,0.05)
self.m.weight.data.uniform_(0,0.05)
def forward(self, cats, conts):
users,movies = cats[:,0],cats[:,1]
u,m = self.u(users),self.m(movies)
return (u*m).sum(1)