Open 256785 opened 1 month ago
yes thats contrastive loss
target = torch.arange(scores.size(0), device=scores.device, dtype=torch.long) target *= (p_reps.size(0) // q_reps.size(0))
why use target as this way,a little confuse
I have some sense each query refers to some samples,use divided to count the num of samples,and use arrange with multiply to find the positive item index. Maybe is that?
def call(self, q_reps, p_reps): if self.negatives_cross_device:
This gathers both negatives and positives.
in the code,does it use ContrastiveLoss following the paper?