sthalles / SimCLR

PyTorch implementation of SimCLR: A Simple Framework for Contrastive Learning of Visual Representations
https://sthalles.github.io/simple-self-supervised-learning/
MIT License
2.19k stars 457 forks source link

Should assert n_views == 2? #32

Open LinglanZhao opened 3 years ago

LinglanZhao commented 3 years ago

Thanks for your excellent implementation! I'd like to confirm that N_VIEW == 2 as in the paper and the default args in the code. If N_VIEW > 2, with logits.shape = (N_VIEW x N, N_VIEW x N - 1) https://github.com/sthalles/SimCLR/blob/1848fc934ad844ae630e6c452300433fe99acfd9/simclr.py#L51, N_VIEW x N - 1 contains at least one more positive pairs (except the one indexed with 0) which will be treated as negative pairs. @sthalles @alessiamarcolini @butyuhao

here101 commented 2 years ago

Have you solved the problem? I meet the same question. Thanks.