VAE: sampling from posteriors

I was experimenting with the convolutional VAE notebook and I was wandering how I could sample from the model posterior. The example there avoids that by exploiting the encoder, which translates input values into means of gaussians in the latent space. This is fine as long as the latent variables are also gaussians (the means/variances are the same and you can use them to sample) but changing the latent variables (or adding new ones) makes this trick unusable. I tried sampling with

zs_sample = approx.sample_node(psi_U,size=1,more_replacements={xs_t:xs_t_minibatch}).eval()

or with

zs_sample = approx.sample_node(psi_U,size=1,more_replacements={xs_t:shared(some_data)}).eval()

but in both cases I’m getting an error

Cannot compute test value: input 0 (mrg_uniform{TensorType(float32, vector),no_inplace}.0) of Op GpuFromHost<None>(mrg_uniform{TensorType(float32, vector),no_inplace}.0) missing default value.  
Backtrace when that variable is created:

At the same time works with both more_replacements={xs_t:xs_t_minibatch}) and.more_replacements={xs_t:shared(data[:minibatch_size]}) This is confusing.

All that was done in pymc3 3.2 with theano 1.0. I guess it has something to do with keras as there is another VAE notebook where keras is not being used and sampling with xs_t:shared(data[..]) works there.

EDIT: I uploaded the full log here.