Error with batch size 256
Traceback (most recent call last):
  File "main_supcon.py", line 265, in <module>
    main()
  File "main_supcon.py", line 247, in main
    loss = train(train_loader, model, criterion, optimizer, epoch, opt)
  File "main_supcon.py", line 205, in train
    loss = criterion(features1,features2)
  File "/DATA/rani.1/miniconda3/envs/sim_test/lib/python3.6/site-packages/torch/nn/modules/module.py", line 1051, in _call_impl
    return forward_call(*input, **kwargs)
  File "/DATA/rani.1/SupSim/losses.py", line 106, in forward
    sim_ij = torch.diag(similarity_matrix, self.batch_size)
RuntimeError: invalid argument 2: invalid size at /opt/conda/conda-bld/pytorch_1623448233824/work/aten/src/THC/THCStorage.cpp:26


when batch size 512 , error
 denominator = self.negatives_mask * torch.exp(similarity_matrix / self.temperature)
RuntimeError: The size of tensor a (1024) must match the size of tensor b (672) at non-singleton dimension 1