Skip to content

Commit

Permalink
✅ add random test to make coverage pass
Browse files Browse the repository at this point in the history
  • Loading branch information
nateraw committed Jul 29, 2020
1 parent 3319aa6 commit 5cff033
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/models/test_autoencoders.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import pytorch_lightning as pl
import torch

from pl_bolts.models.autoencoders import VAE, AE
from pl_bolts.models.autoencoders.basic_ae import AEEncoder
from tests import reset_seed


Expand All @@ -23,3 +25,19 @@ def test_ae(tmpdir):
trainer = pl.Trainer(fast_dev_run=True, default_root_dir=tmpdir)
trainer.fit(model)
trainer.test(model)


def test_basic_ae_encoder(tmpdir):
reset_seed()

hidden_dim = 128
latent_dim = 2
width = height = 28
batch_size = 16
channels = 1

encoder = AEEncoder(hidden_dim, latent_dim, width, height)
x = torch.randn(batch_size, channels, width, height)
z = encoder(x)

assert z.shape == (batch_size, latent_dim)

0 comments on commit 5cff033

Please sign in to comment.