I want to model the mean and variance of the gaussian distribution of an encoder in VAE. Now it’s pretty simple the encoder will have two heads - for mean and variance vector and then we will calculate

the loss = recons loss + KL Loss.

Now I want to calculate the pdf of the encoder distribution q(z|x) as I have the access to the mean and variance of the distribution from the encoder. q(z|x) is a multivariate gaussian but from the encoder i have the mean and variance vector whereas I need a covariance matrix. For example if z is 64 dimesional vector then the encoder will output two 64 dimensional vectors - one for mean and another for variance and each of them has a dimension of 64. To calculate the pdf q(z|x) i need to have 64 x 64 covariance matrix. Can someone please help to estimate q(z|x)?

I am trying to model the p and q in the picture attached which are encoder and decoder respectively

.