| 17 | expansion = 1 |
| 18 | |
| 19 | def __init__(self, |
| 20 | inplanes, |
| 21 | planes, |
| 22 | stride=1, |
| 23 | dilation=1, |
| 24 | downsample=None, |
| 25 | style='pytorch', |
| 26 | with_cp=False, |
| 27 | conv_cfg=None, |
| 28 | norm_cfg=dict(type='BN'), |
| 29 | dcn=None, |
| 30 | plugins=None, |
| 31 | init_cfg=None): |
| 32 | super(BasicBlock, self).__init__(init_cfg) |
| 33 | assert dcn is None, 'Not implemented yet.' |
| 34 | assert plugins is None, 'Not implemented yet.' |
| 35 | |
| 36 | self.norm1_name, norm1 = build_norm_layer(norm_cfg, planes, postfix=1) |
| 37 | self.norm2_name, norm2 = build_norm_layer(norm_cfg, planes, postfix=2) |
| 38 | |
| 39 | self.conv1 = build_conv_layer( |
| 40 | conv_cfg, |
| 41 | inplanes, |
| 42 | planes, |
| 43 | 3, |
| 44 | stride=stride, |
| 45 | padding=dilation, |
| 46 | dilation=dilation, |
| 47 | bias=False) |
| 48 | self.add_module(self.norm1_name, norm1) |
| 49 | self.conv2 = build_conv_layer( |
| 50 | conv_cfg, planes, planes, 3, padding=1, bias=False) |
| 51 | self.add_module(self.norm2_name, norm2) |
| 52 | |
| 53 | self.relu = nn.ReLU(inplace=True) |
| 54 | self.downsample = downsample |
| 55 | self.stride = stride |
| 56 | self.dilation = dilation |
| 57 | self.with_cp = with_cp |
| 58 | |
| 59 | @property |
| 60 | def norm1(self): |