Using HingeEmbedding loss


I’m a little confused about how to use this loss. I have image features that are 300 dimensional and text features which are 300 dimensional. I would like to embed them using HingeEmbeddingLoss. I have “positive” pairs of images and text (would get label +1), and “negative” pairs too (label -1).

Now, how do I set up HingeEmbeddingLoss? Docs say x is a 2D mini-batch tensor and y is a 1D tensor, both of size n. Can someone please elaborate?

Thanks a lot!