Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maxpool in shortcut is redundant #73

Open
liorkad3 opened this issue Dec 31, 2020 · 1 comment
Open

Maxpool in shortcut is redundant #73

liorkad3 opened this issue Dec 31, 2020 · 1 comment

Comments

@liorkad3
Copy link

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?

@xsacha
Copy link
Contributor

xsacha commented Jun 6, 2022

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants