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