Build your own loss function in PyTorch

Hello! The similarity loss you described is interesting. Which paper proposed the loss? Or it’s your own idea?
Thank you!