mseitzer/pytorch-fid

What's the logic of this line code?HELP

RSMung opened this issue · 1 comments

if not np.allclose(np.diagonal(covmean).imag, 0, atol=1e-3):

Why you want to check the elements in diagonal of covmean with 0?
As far as I'm concerned, we just need to save the real value with this code: covmean = covmean.real so that we don't need to check it.
Plz help me, thanks.

It checks that the square root of the product of covariances does not have a large imaginary component. If this is the case, something is wrong with the covariances (not positive definite) and you can not trust the results. This is why the check is necessary.