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

Need your suggestions ? #18

Open
haideralimughal opened this issue Sep 21, 2021 · 0 comments
Open

Need your suggestions ? #18

haideralimughal opened this issue Sep 21, 2021 · 0 comments

Comments

@haideralimughal
Copy link

HI, i am trying to design a simple module of strip pooling for my network. Would you please give me suggestions is it ok or i have to make changes in some places thanks in advance.

class StripPooling(nn.Module):
def init(self, pool_sizes):
super(StripPooling, self).init()
self.pool_sizes = pool_sizes

def forward(self, x):
    h, w = x.shape[2:]
    k_sizes = []
    strides = []
    for pool_size in self.pool_sizes:
        k_sizes.append((int(h / pool_size), int(w / pool_size)))
        strides.append((int(h / pool_size), int(w / pool_size)))

    sp_sum = x

    for i in range(len(self.pool_sizes)):
        out = F.avg_pool2d(x, k_sizes[i], stride=strides[i], padding=0)
        out = F.upsample(out, size=(h, w), mode="bilinear")
        sp_sum = sp_sum + out

    return sp_sum
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

1 participant