Skip to content

Commit

Permalink
Reformat comment slightly
Browse files Browse the repository at this point in the history
  • Loading branch information
tomaarsen committed Dec 2, 2024
1 parent d5359a4 commit 12d3f9e
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions sentence_transformers/losses/MultipleNegativesRankingLoss.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,8 @@ def forward(self, sentence_features: Iterable[dict[str, Tensor]], labels: Tensor

# For every anchor, we compute the similarity to all other candidates (positives and negatives),
# also from other anchors. This gives us a lot of in-batch negatives.
scores = (
self.similarity_fct(anchors, candidates) * self.scale
) # (batch_size, batch_size * (1 + num_negatives))
scores = self.similarity_fct(anchors, candidates) * self.scale
# (batch_size, batch_size * (1 + num_negatives))

# anchor[i] should be most similar to candidates[i], as that is the paired positive,
# so the label for anchor[i] is i
Expand Down

0 comments on commit 12d3f9e

Please sign in to comment.