Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions tests/test_vae.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
from models import VanillaVAE
from torchsummary import summary


class TestVAE(unittest.TestCase):

def setUp(self) -> None:
# self.model2 = VAE(3, 10)
self.model = VanillaVAE(3, 10)
Expand All @@ -22,11 +20,15 @@ def test_forward(self):

def test_loss(self):
x = torch.randn(16, 3, 64, 64)

result = self.model(x)
loss = self.model.loss_function(*result, M_N = 0.005)
print(loss)


def test_reconstruction(self):
x = torch.randn(1, 3, 64, 64)
reconstructed, _, _ = self.model(x)
mse = torch.nn.functional.mse_loss(reconstructed, x)
print(f"Reconstruction MSE: {mse.item()}")

if __name__ == '__main__':
unittest.main()
unittest.main()