cavaface icon indicating copy to clipboard operation
cavaface copied to clipboard

Maxpool in shortcut is redundant

Open liorkad3 opened this issue 3 years ago • 1 comments

In the Bottleneck_IR_SE , the shortcut layer of Maxpool is always with kernel=1 and stride=1. So the layer is useless. Am I missing something?

liorkad3 avatar Dec 31 '20 06:12 liorkad3

This happens in the last bottleneck only, where depth and channels are both the same and stride is not set (so defaults to 1), right? As far as I know it's only a single occurrence in the model and maybe libtorch automatically optimises for it. Otherwise, try:

        if in_channel == depth:
            if stride == 1:
                self.shortcut_layer = Identity()
            else:
                self.shortcut_layer = MaxPool2d(1, stride)

xsacha avatar Jun 06 '22 03:06 xsacha