Parameter for BatchNorm1d is twice the number of features = num_features(layers)*2

in ConvnetBuilder class of fastai is evaluated to 512*2 = 1024. is then passed as num_features to nn.BatchNorm1d.

How can BatchNorm1d accept 1024 features when the layer prior to that (8th layer of resnet34) outputs 512 features.

1 Like

I guess it’s due to the AdaptiveConcatPool2d.

Kind regards

1 Like
self.ap = nn.AdaptiveAvgPool2d(sz) = nn.AdaptiveMaxPool2d(sz)
def forward(self, x): return[, self.ap(x)], 1)

Ah ok, I see that the above code will result in output becoming twice the input because there is column wise concatenation of features.

Thanks for pointing me to the docs link.