A warning occurs even for very small off-diagonal elements> 0. The default tolerance value does not seem to work for 32-bit floats.
As a workaround, skip the higher function tolerance:
np.random.multivariate_normal(mu, cov, tol=1e-6)
More details
np.random.multivariate_normal checks if the covariance is PSD by first decomposing it with (u, s, v) = svd(cov) and then checking if the reconstruction np.dot(vT * s, v) is close enough to the original cov .
With float32 the reconstruction result is even larger than the default allowable allowable 1e-8 , and the function raises a warning.
source share