Super slow when Initialize MultivariateNormal with covariance matrix


I am new to pytorch and want to sample batch data from MultivariantNormal distribution because I would like to predict the correlation between my out put.

Previously I use the scale_tril (Cholesky decomposition) to generate the MultivariantNormal and worked quite good. However now I could not directly form up the Cholesky decomposition from my algorithm but instead get the full covariance matrix. I feed it to MultivariantNormal but the initialization of this MultivariantNormal would cause a super slow computation speed (because it has to firstly compute the Cholesky Decomposition from full covariance matrix).

So my question is how can I overcome this computation catastropy?

Thank you in advance,


Soluion: turn the validation term to False will get avoid the eigen value positive checking, and will speed up the computation (x100)…