Pytorch Custom Loss Function Tensorflow