Solved by albanD in post #2 
              
              
                Hi, 
Variables are not needed anymore. and predict methods should not be needed. An updated version of your code is: 
import torch
from torch.autograd import Variable

class MatrixFactorization(torch.nn.Module):
    def __init__(self, n_items=len(movie_ids), n_factors=300):
        super().__init__(…