hi!

I have a VAE . From my model i got the output of encoder , and it is a tensor like this [32,192,4,4] (32 is batchsize(the last 32 imgs from dataset), 192 is nchannels after conv, 4 and 4 pixels dim).

How i can plot using PCA or TSNE ?

Help me please

Hi! I’m not super sure by what you mean by ‘plot the latent space’. Could you clarify what you mean?

Generally, the latent space of a VAE is represented as some probability distribution (e.g. a vector representing each the mean and variance of each latent dimension). If I unerstand your case correctly, the output of the final convolutional layer should be flattened into a vector and passed through one or more fully connected layers to produce the mean and variance of the probability distribution in the latent space. Then of course you can plot the distribution of your latent variables.

Another way of exploring the data manifold/latent space visually is to sample from the latent space in regular intervals and examine the corresponding outputs that the decoder produces (for example, similar to figure 4 in Kingma and Welling (2013))

Hope this helps!