I am trying to make use of LowRankMultivariateNormal but I have trouble to correctly specify
cov_diag. Unfortunately, the example in the documentation also raises a
ValueError for me (pytorch version 1.3.1):
m = LowRankMultivariateNormal(torch.zeros(2), torch.tensor([1, 0]), torch.tensor([1, 1]))
# ValueError: cov_factor must be at least two-dimensional, with optional leading batch dimensions
I haven’t been able to figure out the right amount of (un-) squeezing to make it work. Can someone help?
Thanks for reporting this issue!
The example doesn’t seem to work indeed.
Could you use these test use cases as an example code, while this issue is being fixed?
Oops… the cov_factor in the example is missing a trailing dimension (which has size “rank”). Thanks for pointing it out! I’ll fix it soon. In the meantime, you can simply unsqueeze cov_factor to say that the distribution has rank 1. In general, cov_factor will have shape event_shape + rank
Ah great, thank you! This works for me (I had to change the integers for the tensor creation of
cov_factor to floats as otherwise one gets a
RuntimeError: "cholesky_cpu" not implemented for 'Long')
LowRankMultivariateNormal(torch.zeros(2), torch.tensor([1.0, 0.0]).unsqueeze(-1), torch.tensor([1, 1]))
May I ask: if we have a low-rank cov-matrix at hand, what is the correct way to find out cov_factor and cov_diag, in order to use this LowRankMultivariateNormal() function ??
The example here is a very simplified case I guess.