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

Spatial Average Pooling has same implementation for pooling and unpooling? #3

Closed
joverwey opened this issue Aug 17, 2022 · 2 comments
Closed

Comments

@joverwey
Copy link

Is this intended?

class S_AvgPool(nn.Module):
    def __init__(self):
        super(S_AvgPool, self).__init__()

    def forward(self, x, M):
        x = torch.einsum('nctv,vw->nctw', x, M)
        return x.contiguous()


class S_AvgUnpool(nn.Module):
    def __init__(self):
        super(S_AvgUnpool, self).__init__()

    def forward(self, x, M):
        x = torch.einsum('nctv,vw->nctw', x, M)
        return x.contiguous()
@soomean
Copy link
Owner

soomean commented Aug 28, 2022

�It is implemented in this manner just for maintaining consistency with the temporal pooling/unpooling methods, even if both methods require the same operation.

@joverwey
Copy link
Author

I see, otherwise you would have to name it AvgPoolOrUnpool, which would be confusing to read. This way you can see the intension while reading the code.

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