diff options
author | Jordan Gong <jordan.gong@protonmail.com> | 2021-02-08 18:34:31 +0800 |
---|---|---|
committer | Jordan Gong <jordan.gong@protonmail.com> | 2021-02-08 18:34:31 +0800 |
commit | 31e0294cdb2ffd5241c7e85a6e1e98a4ee20ae28 (patch) | |
tree | 709ddcf8ba175d09e9be4a91aab4c0eb61679c74 /models/layers.py | |
parent | afe615408c4003a513811d900fe3edd119a735a5 (diff) | |
parent | d380e04df37593e414bd5641db100613fb2ad882 (diff) |
Merge branch 'python3.8' into python3.7
# Conflicts:
# utils/configuration.py
Diffstat (limited to 'models/layers.py')
-rw-r--r-- | models/layers.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/models/layers.py b/models/layers.py index 7f2ccec..98e4c10 100644 --- a/models/layers.py +++ b/models/layers.py @@ -167,12 +167,13 @@ class HorizontalPyramidPooling(BasicConv2d): self, in_channels: int, out_channels: int, - kernel_size: Union[int, Tuple[int, int]] = 1, + use_1x1conv: bool = False, use_avg_pool: bool = True, - use_max_pool: bool = True, + use_max_pool: bool = False, **kwargs ): - super().__init__(in_channels, out_channels, kernel_size, **kwargs) + super().__init__(in_channels, out_channels, kernel_size=1, **kwargs) + self.use_1x1conv = use_1x1conv 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.' @@ -186,5 +187,6 @@ class HorizontalPyramidPooling(BasicConv2d): x = self.avg_pool(x) elif not self.use_avg_pool and self.use_max_pool: x = self.max_pool(x) - x = super().forward(x) + if self.use_1x1conv: + x = super().forward(x) return x |