Parameterizing Cholesky factors of full rank covariances

So I’m trying to parameterize a set of full-rank covariance or precision matrices for, eg., Gaussian mixture models or mixture density networks.

I want to define torch.nn.Parameters for the (log) diagonals and lower triangular parts of the Cholesky factors respectively, and then package those parameters together into the Cholesky factors (and then covariance or precision matrices).

In tensorflow I can do this easily with tf.distributions.fill_triangular(), but as far as I can tell no such function exists in torch. What’s the easiest way to achieve something equivalent in torch?