I’m not sure what the exact difference between the linked paper and this one 3 is, but the latter was implemented in this repository 15, which might be a good base for you to implement your SupConLoss.
Alternatively, could you point me to the section of the paper, which corresponds to your implementation, so that I could try to figure out the shapes?