Question about the Colab filtering model

Hello People!

So I have two question wrt the colab filtering code

class DotProduct(Module):
   def __init__(self, n_users, n_movies, n_factors):
        self.user_factors = Embedding(n_users, n_factors)
        self.movie_factors = Embedding(n_movies, n_factors)
def forward(self, x):
    users = self.user_factors(x[:,0])
    movies = self.movie_factors(x[:,1])
    return (users * movies).sum(dim=1)
  1. Why is self.user_factors(x[:,0]) indexed with a ‘:’? Aren’t models supposed to be built with the idea of a single input not a batch?
  2. why is the sum happening along dim 1 and not 0 ? I can’t quite grasp the intuition behind that