Created
January 15, 2024 18:56
-
-
Save gauravchak/eaabe02cd5d7b2418dd24161381c7a9c to your computer and use it in GitHub Desktop.
Schematic of two tower user and item encoder
This file contains hidden or 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()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment