Skip to content

Commit

Permalink
Merge pull request #1999 from BishopLiu/master
Browse files Browse the repository at this point in the history
FIX: fix neg sample eval bugs for diffrec and ldiffrec
  • Loading branch information
BishopLiu authored Feb 27, 2024
2 parents de6690e + f11c765 commit f95fde5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion recbole/model/general_recommender/diffrec.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ def full_sort_predict(self, interaction):
def predict(self, interaction):
item = interaction[self.ITEM_ID]
x_t = self.full_sort_predict(interaction)
scores = x_t[:, item]
scores = x_t[torch.arange(len(item)).to(self.device), item]
return scores

def calculate_loss(self, interaction):
Expand Down
2 changes: 1 addition & 1 deletion recbole/model/general_recommender/ldiffrec.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ def full_sort_predict(self, interaction):
def predict(self, interaction):
item = interaction[self.ITEM_ID]
x_t = self.full_sort_predict(interaction)
scores = x_t[:, item]
scores = x_t[torch.arange(len(item)).to(self.device), item]
return scores


Expand Down

0 comments on commit f95fde5

Please sign in to comment.