# Codeblock 4 class DenseBlock(nn.Module): def __init__(self, in_channels, repeats): super().__init__() self.bottlenecks = nn.ModuleList() #(1) for i in range(repeats): current_in_channels = in_channels + i*GROWTH #(2) self.bottlenecks.append(Bottleneck(in_channels=current_in_channels)) #(3) def forward(self, x): for i, bottleneck in enumerate(self.bottlenecks): x = bottleneck(x) print(f'after bottleneck #{i}\t: {x.size()}') return x