I have a graph convolution model built and wanted to implement a custom unsupervised loss function like the one shown in below picture:

Where yv is the learned embedding of a node v and rand denotes random sampling operation over all the nodes
I am new to Pytorch so not sure if this is already implemented. Any help will be sincerely appreciated.