Pytorch version of ApproxNDCGLoss

How to convert the TensorFlow ApproxNDCGLoss to Pytorch?