summaryrefslogtreecommitdiff
path: root/models/layers.py
diff options
context:
space:
mode:
authorJordan Gong <jordan.gong@protonmail.com>2021-03-12 13:56:17 +0800
committerJordan Gong <jordan.gong@protonmail.com>2021-03-12 13:56:17 +0800
commitc74df416b00f837ba051f3947be92f76e7afbd88 (patch)
tree02983df94008bbb427c2066c5f619e0ffdefe1c5 /models/layers.py
parent1b8d1614168ce6590c5e029c7f1007ac9b17048c (diff)
Code refactoring
1. Separate FCs and triplet losses for HPM and PartNet 2. Remove FC-equivalent 1x1 conv layers in HPM 3. Support adjustable learning rate schedulers
Diffstat (limited to 'models/layers.py')
-rw-r--r--models/layers.py9
1 files changed, 0 insertions, 9 deletions
diff --git a/models/layers.py b/models/layers.py
index f1d72b6..c609698 100644
--- a/models/layers.py
+++ b/models/layers.py
@@ -167,17 +167,10 @@ class BasicConv1d(nn.Module):
class HorizontalPyramidPooling(nn.Module):
def __init__(
self,
- in_channels: int,
- out_channels: int,
- use_1x1conv: bool = False,
use_avg_pool: bool = True,
use_max_pool: bool = False,
- **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.'
@@ -191,6 +184,4 @@ class HorizontalPyramidPooling(nn.Module):
x = self.avg_pool(x)
elif not self.use_avg_pool and self.use_max_pool:
x = self.max_pool(x)
- if self.use_1x1conv:
- x = self.conv(x)
return x