(self)
| 16 | print(('Testing %s.%s' % (type(self).__name__, self._testMethodName))) |
| 17 | |
| 18 | def test_genet_withfc(self): |
| 19 | for struct in ['normal', 'large']: |
| 20 | with torch.no_grad(): |
| 21 | # input data |
| 22 | batch_size = random.randint(10, 30) |
| 23 | a = torch.rand(batch_size, 3, 224, 224).to('cuda') |
| 24 | |
| 25 | num_classes = random.randint(10, 1000) |
| 26 | net = PlainNet(struct, num_classes=num_classes).to('cuda') |
| 27 | net.init_weights() |
| 28 | net.eval() |
| 29 | |
| 30 | self.assertTrue(len(list(net(a)[-1].shape)) == 2) |
| 31 | |
| 32 | self.assertTrue(net(a)[-1].size(1) == num_classes) |
| 33 | |
| 34 | self.assertTrue(net(a)[-1].size(0) == batch_size) |
| 35 | |
| 36 | def test_genet_withoutfc(self): |
| 37 | for struct in ['normal', 'large']: |
nothing calls this directly
no test coverage detected