Resnet 50 with contrastive loss

I want to do multi-class classification with a pre-trained resnet50 with contrastive loss. I want to calculate the loss between the actual label and the label predicted by the model. But while searching, I came across some questions.
first, should I necessarily use supervised contrastive learning to use contrastive loss? The method is explained in this link. It seems that it first generates more data from the initial data and then calculates the loss.
secondly, there is also some prepared function like this, But I do not know how to use them. or do you know other prepared functions?
Thank you in advance.