summaryrefslogtreecommitdiff
path: root/models/layers.py
diff options
context:
space:
mode:
authorJordan Gong <jordan.gong@protonmail.com>2021-02-18 18:34:24 +0800
committerJordan Gong <jordan.gong@protonmail.com>2021-02-18 18:36:47 +0800
commitf075fde91e6e5e7ac5d0f146df9cfde2b22fa150 (patch)
treef5c86dff6086ab8316a1f371585a0fab191aefa4 /models/layers.py
parent31af04b70fcc0e7b46cbe18a52d150eb4e274f0e (diff)
parent84a3d5991f2f7272d1be54ad6cfe6ce695f915a0 (diff)
Merge branch 'master' into python3.8
Diffstat (limited to 'models/layers.py')
-rw-r--r--models/layers.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/models/layers.py b/models/layers.py
index 98e4c10..ae61583 100644
--- a/models/layers.py
+++ b/models/layers.py
@@ -162,7 +162,7 @@ class BasicConv1d(nn.Module):
return self.conv(x)
-class HorizontalPyramidPooling(BasicConv2d):
+class HorizontalPyramidPooling(nn.Module):
def __init__(
self,
in_channels: int,
@@ -172,8 +172,10 @@ class HorizontalPyramidPooling(BasicConv2d):
use_max_pool: bool = False,
**kwargs
):
- super().__init__(in_channels, out_channels, kernel_size=1, **kwargs)
+ super().__init__()
self.use_1x1conv = use_1x1conv
+ if use_1x1conv:
+ self.conv = BasicConv2d(in_channels, out_channels, 1, **kwargs)
self.use_avg_pool = use_avg_pool
self.use_max_pool = use_max_pool
assert use_avg_pool or use_max_pool, 'Pooling layer(s) required.'
@@ -188,5 +190,5 @@ class HorizontalPyramidPooling(BasicConv2d):
elif not self.use_avg_pool and self.use_max_pool:
x = self.max_pool(x)
if self.use_1x1conv:
- x = super().forward(x)
+ x = self.conv(x)
return x