MoCo trains the query to pick its positive key out of a large queue of negative keys. The loss is InfoNCE: a softmax over normalized similarities, scaled by a temperature.
Implement info_nce(q, k_pos, negatives, tau), normalizing the query and keys, then computing the softmax loss of the positive.
Normalize the query and all keys, compute scaled dot products, then use logsumexp minus the positive logit.
No results yet
Run your code to check it against the examples, or submit to run every test.