forked from AntixK/PyTorch-VAE
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_wae.py
31 lines (22 loc) · 787 Bytes
/
test_wae.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import torch
import unittest
from models import WAE_MMD
from torchsummary import summary
class TestWAE(unittest.TestCase):
def setUp(self) -> None:
self.model = WAE_MMD(3, 10, reg_weight = 100)
def test_summary(self):
print(summary(self.model, (3, 64, 64), device='cpu'))
# print(summary(self.model2, (3, 64, 64), device='cpu'))
def test_forward(self):
x = torch.randn(16, 3, 64, 64)
y = self.model(x)
print("Model Output size:", y[0].size())
# print("Model2 Output size:", self.model2(x)[0].size())
def test_loss(self):
x = torch.randn(16, 3, 64, 64)
result = self.model(x)
loss = self.model.loss_function(*result)
print(loss)
if __name__ == '__main__':
unittest.main()