Usage of nn.ModuleList
<SCODE> module = [nn.Conv2d(1,64, 3, stride = (1,1), padding = (1,1)), nn.BatchNorm2d(
 self.module_list = nn.ModuleList(module)
 self.module_list += module
<ECODE> Each “module”, is composed of a Conv2d, and a BatchNorm. What I would like self.module_list to be, is: Conv2d -> BatchNorm -> Conv2d -> BatchNorm Is this the right way to go about it? Thanks!!
Kalamaya
No, you’re adding the same modules, with the same weights twice. You need to create a new list, and append that after construction. <SCODE>def make_sequence():
    return [nn.Conv2d(1,64, 3, stride = (1,1), padding = (1,1)), ...]

self.module_list = nn.ModuleList()
for i in range(5):
    self.module_list += make_sequence()
<ECODE>
apaszke