@InnovArul  I have got still one question. Is the part for the Mahalanobis-distance in the formula you wrote:
dist = multivariate_normal.MultivariateNormal(loc=torch.zeros(5), covariance_matrix=torch.eye(5))
the same as

because in literature the Mahalanobis-distance is given with square root instead of -0.5 as a factor