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

Class SEBasicBlock

models/__init__.py:200–234  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

198
199
200class SEBasicBlock(nn.Module):
201 expansion = 1
202
203 def __init__(self, inplanes, planes, stride=1, downsample=None, groups=1,
204 base_width=64, dilation=1, norm_layer=None,
205 *, reduction=16):
206 super(SEBasicBlock, self).__init__()
207 if norm_layer is None:
208 norm_layer = nn.BatchNorm2d
209 self.conv1 = conv3x3(inplanes, planes, stride)
210 self.bn1 = norm_layer(planes)
211 self.relu = nn.ReLU(inplace=True)
212 self.conv2 = conv3x3(planes, planes, 1)
213 self.bn2 = norm_layer(planes)
214 self.se = SELayer(planes, reduction)
215 self.downsample = downsample
216 self.stride = stride
217
218 def forward(self, x):
219 residual = x
220 out = self.conv1(x)
221 out = self.bn1(out)
222 out = self.relu(out)
223
224 out = self.conv2(out)
225 out = self.bn2(out)
226 out = self.se(out)
227
228 if self.downsample is not None:
229 residual = self.downsample(x)
230
231 out += residual
232 out = self.relu(out)
233
234 return out
235
236
237class SEBottleneck(nn.Module):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected