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()])
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
def test_ae_with_gan_loss_func(): with pytest.raises(DazeModelTypeError): model = dz.AutoEncoder(ConvolutionalEncoder(3), CifarDecoder(), loss_funcs=[dz.loss.feature_matching()])
def test_ae_with_vae_loss_func(): with pytest.raises(DazeModelTypeError): model = dz.AutoEncoder(ConvolutionalEncoder(3), CifarDecoder(), loss_funcs=[dz.loss.kl()])
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())
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])
def test_default(): model = dz.AutoEncoder(ConvolutionalEncoder(3), CifarDecoder()) cbs = make_callbacks(model) train(model, cbs)