This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Compute the user embedding | |
user_embedding = self.compute_user_embedding( | |
user_id, user_features, user_history | |
) # [B, DU] | |
# Compute item embeddings | |
item_embeddings = self.compute_item_embeddings( | |
item_id, item_features | |
) # [B, DI] | |
# Compute the scores for every pair of user and item | |
scores = torch.matmul(user_embedding, item_embeddings.t()) |