I have the following code, which I do not understand completely:
class ResMod(nn.Module): def __init__(self, cin, cout, reps=5): super(ResMod, self).__init__() self.expand = BottleneckSparse(cin, cout, use_norm=False) self.pool = MASPool(cout, 2, 2) self.layers = nn.ModuleList([BottleneckSparse(cout, cout, use_norm=False) for _ in range(reps)]) def forward(self, input): x, m = input x, m = self.expand((x, m)) x, m = self.pool((x, m)) for L in self.layers: x, m = L((x, m)) return x, m
Do I understand this correctly, that the custom BottleneckSparse Layer is used 5 times in the ModuleList?
Is the forward path then:
Bottleneck > Pool > 5x Bottleneck?
with the bottlenecks being added in the “for L”-part?