コード例 #1
0
ファイル: test_vae.py プロジェクト: JesseLivezey/pylearn2
def test_diagonal_gaussian_sample_from_conditional():
    """
    DiagonalGaussian.sample_from_conditional works when num_samples is provided
    """
    mlp = MLP(layers=[Linear(layer_name="h", dim=5, irange=0.01, max_col_norm=0.01)])
    conditional = DiagonalGaussian(mlp=mlp, name="conditional")
    vae = DummyVAE()
    conditional.set_vae(vae)
    input_space = VectorSpace(dim=5)
    conditional.initialize_parameters(input_space=input_space, ndim=5)
    mu = T.matrix("mu")
    log_sigma = T.matrix("log_sigma")
    conditional.sample_from_conditional([mu, log_sigma], num_samples=2)
コード例 #2
0
ファイル: test_vae.py プロジェクト: rudaoshi/pylearn2
def test_diagonal_gaussian_sample_from_conditional():
    """
    DiagonalGaussian.sample_from_conditional works when num_samples is provided
    """
    mlp = MLP(layers=[Linear(layer_name='h', dim=5, irange=0.01,
                             max_col_norm=0.01)])
    conditional = DiagonalGaussian(mlp=mlp, name='conditional')
    vae = DummyVAE()
    conditional.set_vae(vae)
    input_space = VectorSpace(dim=5)
    conditional.initialize_parameters(input_space=input_space, ndim=5)
    mu = T.matrix('mu')
    log_sigma = T.matrix('log_sigma')
    conditional.sample_from_conditional([mu, log_sigma], num_samples=2)
コード例 #3
0
ファイル: test_vae.py プロジェクト: JesseLivezey/pylearn2
def test_diagonal_gaussian_reparametrization_trick():
    """
    DiagonalGaussian.sample_from_conditional works when asked to sample using
    the reparametrization trick
    """
    mlp = MLP(layers=[Linear(layer_name="h", dim=5, irange=0.01, max_col_norm=0.01)])
    conditional = DiagonalGaussian(mlp=mlp, name="conditional")
    vae = DummyVAE()
    conditional.set_vae(vae)
    input_space = VectorSpace(dim=5)
    conditional.initialize_parameters(input_space=input_space, ndim=5)
    mu = T.matrix("mu")
    log_sigma = T.matrix("log_sigma")
    epsilon = T.tensor3("epsilon")
    conditional.sample_from_conditional([mu, log_sigma], epsilon=epsilon)
コード例 #4
0
ファイル: test_vae.py プロジェクト: rudaoshi/pylearn2
def test_diagonal_gaussian_reparametrization_trick():
    """
    DiagonalGaussian.sample_from_conditional works when asked to sample using
    the reparametrization trick
    """
    mlp = MLP(layers=[Linear(layer_name='h', dim=5, irange=0.01,
                             max_col_norm=0.01)])
    conditional = DiagonalGaussian(mlp=mlp, name='conditional')
    vae = DummyVAE()
    conditional.set_vae(vae)
    input_space = VectorSpace(dim=5)
    conditional.initialize_parameters(input_space=input_space, ndim=5)
    mu = T.matrix('mu')
    log_sigma = T.matrix('log_sigma')
    epsilon = T.tensor3('epsilon')
    conditional.sample_from_conditional([mu, log_sigma], epsilon=epsilon)