def test_bernoulli_vector_default_output_layer(): """ BernoulliVector's default output layer is compatible with its required output space """ mlp = MLP(layers=[Linear(layer_name="h", dim=5, irange=0.01, max_col_norm=0.01)]) conditional = BernoulliVector(mlp=mlp, name="conditional") vae = DummyVAE() conditional.set_vae(vae) input_space = VectorSpace(dim=5) conditional.initialize_parameters(input_space=input_space, ndim=5)
def test_bernoulli_vector_conditional_expectation(): """ BernoulliVector.conditional_expectation doesn't crash """ mlp = MLP(layers=[Linear(layer_name="h", dim=5, irange=0.01, max_col_norm=0.01)]) conditional = BernoulliVector(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") conditional.conditional_expectation([mu])
def test_bernoulli_vector_sample_from_conditional(): """ BernoulliVector.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 = BernoulliVector(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") conditional.sample_from_conditional([mu], num_samples=2)
def test_bernoulli_vector_default_output_layer(): """ BernoulliVector's default output layer is compatible with its required output space """ mlp = MLP(layers=[Linear(layer_name='h', dim=5, irange=0.01, max_col_norm=0.01)]) conditional = BernoulliVector(mlp=mlp, name='conditional') vae = DummyVAE() conditional.set_vae(vae) input_space = VectorSpace(dim=5) conditional.initialize_parameters(input_space=input_space, ndim=5)
def test_bernoulli_vector_conditional_expectation(): """ BernoulliVector.conditional_expectation doesn't crash """ mlp = MLP(layers=[Linear(layer_name='h', dim=5, irange=0.01, max_col_norm=0.01)]) conditional = BernoulliVector(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') conditional.conditional_expectation([mu])
def test_bernoulli_vector_sample_from_conditional(): """ BernoulliVector.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 = BernoulliVector(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') conditional.sample_from_conditional([mu], num_samples=2)
def test_bernoulli_vector_reparametrization_trick(): """ BernoulliVector.sample_from_conditional raises an error 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 = BernoulliVector(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") epsilon = T.tensor3("epsilon") conditional.sample_from_conditional([mu], epsilon=epsilon)
def test_bernoulli_vector_reparametrization_trick(): """ BernoulliVector.sample_from_conditional raises an error 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 = BernoulliVector(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') epsilon = T.tensor3('epsilon') conditional.sample_from_conditional([mu], epsilon=epsilon)