Пример #1
0
def test_ae_with_vae_forward_pass():
    with pytest.raises(DazeModelTypeError):
        model = dz.AutoEncoder(
            ConvolutionalEncoder(3),
            CifarDecoder(),
            forward_pass_func=dz.forward_pass.probabilistic_encode_decode(),
            loss_funcs=[dz.loss.latent_l1()])
Пример #2
0
def test_get_batch_encodings_np():
    x, _ = dz.data.cifar10.load(70, "f32")
    x /= 255
    model = dz.AutoEncoder(ConvolutionalEncoder(latent_dim=2), CifarDecoder())
    encodings = model.get_batch_encodings(x)
    assert isinstance(encodings, tf.Tensor)
    assert encodings.numpy().shape[0] == 70
    assert encodings.numpy().shape[1] == 2
Пример #3
0
def test_ae_with_gan_loss_func():
    with pytest.raises(DazeModelTypeError):
        model = dz.AutoEncoder(ConvolutionalEncoder(3),
                               CifarDecoder(),
                               loss_funcs=[dz.loss.feature_matching()])
Пример #4
0
def test_ae_with_vae_loss_func():
    with pytest.raises(DazeModelTypeError):
        model = dz.AutoEncoder(ConvolutionalEncoder(3),
                               CifarDecoder(),
                               loss_funcs=[dz.loss.kl()])
Пример #5
0
def test_ae_with_gan_forward_pass():
    with pytest.raises(DazeModelTypeError):
        model = dz.AutoEncoder(
            ConvolutionalEncoder(3),
            CifarDecoder(),
            forward_pass_func=dz.forward_pass.generative_adversarial())
Пример #6
0
def test_get_batch_encodings_unknown():
    with pytest.raises(ValueError):
        model = dz.AutoEncoder(ConvolutionalEncoder(latent_dim=2),
                               CifarDecoder())
        encodings = model.get_batch_encodings([1.0, 2.0, 3.0])
Пример #7
0
def test_default():
    model = dz.AutoEncoder(ConvolutionalEncoder(3), CifarDecoder())
    cbs = make_callbacks(model)
    train(model, cbs)