MCPcopy Create free account
hub / github.com/pytorch/pytorch / test_modules

Method test_modules

test/test_nn.py:473–484  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

471 self.assertEqual(list(s.named_children()), [('layer1', l1), ('layer2', l2), ('subnet', subnet)])
472
473 def test_modules(self):
474 class Net(nn.Module):
475 def __init__(self):
476 super().__init__()
477 self.l1 = l
478 self.l2 = l
479 self.param = torch.empty(3, 5)
480
481 l = nn.Linear(10, 20)
482 n = Net()
483 s = nn.Sequential(n, n, n, n)
484 self.assertEqual(list(s.modules()), [s, n, l])
485
486 def test_named_modules(self):
487 class Net(nn.Module):

Callers

nothing calls this directly

Calls 4

listFunction · 0.85
NetClass · 0.70
assertEqualMethod · 0.45
modulesMethod · 0.45

Tested by

no test coverage detected