CLIP (Radford et al., 2021) trains an image encoder and a text encoder so that matching pairs have high similarity. The first step is the full matrix of similarities between every image and every caption in the batch.
Implement clip_logits(img, txt, temp), returning the scaled cosine similarity matrix.
Divide each row by its norm, multiply the image matrix by the transposed text matrix, then divide by the temperature.
No results yet
Run your code to check it against the examples, or submit to run every test.