def forward(self, user_representations, targets):
        """
        Compute predictions for target items given user representations.

        Parameters
        ----------

        user_representations: tensor
            Result of the user_representation_method.
        targets: tensor
            A minibatch of item sequences of shape
            (minibatch_size, sequence_length).

        Returns
        -------

        predictions: tensor
            of shape (minibatch_size, sequence_length)
        """

        user_components = user_representations[:, :self.num_mixtures, :, :]
        mixture_vectors = user_representations[:, self.num_mixtures:, :, :]

        target_embedding = (self.item_embeddings(targets)
                            .permute(0, 2, 1))
        target_bias = self.item_biases(targets).squeeze()

        mixture_weights = (mixture_vectors * target_embedding
                           .unsqueeze(1)
                           .expand_as(user_components))
        mixture_weights = (F.softmax(mixture_weights.sum(2), 1)
                           .unsqueeze(2)
                           .expand_as(user_components))
        weighted_user_representations = (mixture_weights * user_components).sum(1)

        dot = ((weighted_user_representations * target_embedding)
               .sum(1)
               .squeeze())

        return target_bias + dot

        Compute predictions for target items given user representations.

        Parameters
        ----------

        user_representations: tensor
            Result of the user_representation_method.
        targets: tensor
            A minibatch of item sequences of shape
            (minibatch_size, sequence_length).

        Returns
        -------

        predictions: tensor
            of shape (minibatch_size, sequence_length)
        
spotlight/sequence/representations.py