MCPcopy Create free account
hub / github.com/deepbrainai-research/float / SELayer

Class SELayer

models/__init__.py:182–197  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

180
181
182class SELayer(nn.Module):
183 def __init__(self, channel, reduction=16):
184 super(SELayer, self).__init__()
185 self.avg_pool = nn.AdaptiveAvgPool2d(1)
186 self.fc = nn.Sequential(
187 nn.Linear(channel, channel // reduction, bias=False),
188 nn.ReLU(inplace=True),
189 nn.Linear(channel // reduction, channel, bias=False),
190 nn.Sigmoid()
191 )
192
193 def forward(self, x):
194 b, c, _, _ = x.size()
195 y = self.avg_pool(x).view(b, c)
196 y = self.fc(y).view(b, c, 1, 1)
197 return x * y.expand_as(x)
198
199
200class SEBasicBlock(nn.Module):

Callers 2

__init__Method · 0.85
__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected