donut
donut copied to clipboard
Fetch Tensor of Samples before MonteCarlo Integration
When calling the reconstruct
function in vae.py
it only returns a single (averaged) value, the reconstruction of the input. Is it possible to access the reconstructions before the averaging is done? I want to have the reconstruction for each sampled latent variable separately.
Looking at the reconstruct function
:
def reconstruct(self, x, n_z=None, n_x=None):
"""
Sample reconstructed `x` from :math:`p(x|h(z))`, where `z` is (are)
sampled from :math:`q(z|h(x))` using the specified observation `x`.
Args:
x: The observation `x` for :math:`q(z|h(x))`.
n_z: Number of intermediate `z` samples to take for each input `x`.
n_x: Number of reconstructed `x` samples to take for each `z`.
Returns:
StochasticTensor: The reconstructed samples `x`.
"""
with tf.name_scope('VAE.reconstruct'):
q_net = self.variational(x, n_z=n_z)
model = self.model(z=q_net['z'], n_z=n_z, n_x=n_x)
return model['x']
Could this be done from here?