Pytorch Custom Loss Function Tensorflow Model