| 322 | |
| 323 | # Using leaf_modules in the update should always work |
| 324 | class MyModel(nn.Module): |
| 325 | def __init__(self): |
| 326 | super().__init__() |
| 327 | self.stuff = [nn.Linear(2, 2), 0, nn.Linear(2, 2)] |
| 328 | self.more_stuff = {"hi": nn.Linear(2, 2), "bye": 0} |
| 329 | |
| 330 | m = MyModel() |
| 331 | m.update_modules(m.leaf_modules()) |
no outgoing calls