This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
import torch | |
import torch.linalg as linalg | |
def calculate_2_wasserstein_dist(X, Y): | |
''' | |
Calulates the two components of the 2-Wasserstein metric: | |
The general formula is given by: d(P_X, P_Y) = min_{X, Y} E[|X-Y|^2] | |
For multivariate gaussian distributed inputs z_X ~ MN(mu_X, cov_X) and z_Y ~ MN(mu_Y, cov_Y), |