def test_one_sample_allowed():
 encoding_model = MLP(layers=[Linear(layer_name='h', dim=10, irange=0.01)])
 decoding_model = MLP(layers=[Linear(layer_name='h', dim=10, irange=0.01)])
 prior = DiagonalGaussianPrior()
 conditional = BernoulliVector(mlp=decoding_model, name='conditional')
 posterior = DiagonalGaussian(mlp=encoding_model, name='posterior')
 vae = VAE(nvis=10, prior=prior, conditional=conditional, posterior=posterior, nhid=5)
 X = T.matrix('X')
 lower_bound = vae.log_likelihood_lower_bound(X, num_samples=1)
 f = theano.function(inputs=[X], outputs=lower_bound)
 rng = make_np_rng(default_seed=11223)
 f(as_floatX(rng.uniform(size=(10, 10))))

def test_one_sample_allowed ( ) : encoding_model = MLP ( layers = [ Linear ( layer_name = 'h' , dim = 10 , irange = 0.01 ) ] ) decoding_model = MLP ( layers = [ Linear ( layer_name = 'h' , dim = 10 , irange = 0.01 ) ] ) prior = DiagonalGaussianPrior ( ) conditional = BernoulliVector ( mlp = decoding_model , name = 'conditional' ) posterior = DiagonalGaussian ( mlp = encoding_model , name = 'posterior' ) vae = VAE ( nvis = 10 , prior = prior , conditional = conditional , posterior = posterior , nhid = 5 ) X = T . matrix ( 'X' ) lower_bound = vae . log_likelihood_lower_bound ( X , num_samples = 1 ) f = theano . function ( inputs = [ X ] , outputs = lower_bound ) rng = make_np_rng ( default_seed = 11223 ) f ( as_floatX ( rng . uniform ( size = ( 10 , 10 ) ) ) )
vae allows one sample per data point .