(self,
inplanes,
planes,
stride=1,
dilation=1,
downsample=None,
style='pytorch',
with_cp=False,
conv_cfg=None,
norm_cfg=dict(type='BN'),
dcn=None,
plugins=None,
init_cfg=None)
| 106 | expansion = 4 |
| 107 | |
| 108 | def __init__(self, |
| 109 | inplanes, |
| 110 | planes, |
| 111 | stride=1, |
| 112 | dilation=1, |
| 113 | downsample=None, |
| 114 | style='pytorch', |
| 115 | with_cp=False, |
| 116 | conv_cfg=None, |
| 117 | norm_cfg=dict(type='BN'), |
| 118 | dcn=None, |
| 119 | plugins=None, |
| 120 | init_cfg=None): |
| 121 | super(Bottleneck, self).__init__(init_cfg) |
| 122 | assert style in ['pytorch', 'caffe'] |
| 123 | assert dcn is None or isinstance(dcn, dict) |
| 124 | assert plugins is None or isinstance(plugins, list) |
| 125 | if plugins is not None: |
| 126 | allowed_position = ['after_conv1', 'after_conv2', 'after_conv3'] |
| 127 | assert all(p['position'] in allowed_position for p in plugins) |
| 128 | |
| 129 | self.inplanes = inplanes |
| 130 | self.planes = planes |
| 131 | self.stride = stride |
| 132 | self.dilation = dilation |
| 133 | self.style = style |
| 134 | self.with_cp = with_cp |
| 135 | self.conv_cfg = conv_cfg |
| 136 | self.norm_cfg = norm_cfg |
| 137 | self.dcn = dcn |
| 138 | self.with_dcn = dcn is not None |
| 139 | self.plugins = plugins |
| 140 | self.with_plugins = plugins is not None |
| 141 | |
| 142 | if self.with_plugins: |
| 143 | # collect plugins for conv1/conv2/conv3 |
| 144 | self.after_conv1_plugins = [ |
| 145 | plugin['cfg'] for plugin in plugins |
| 146 | if plugin['position'] == 'after_conv1' |
| 147 | ] |
| 148 | self.after_conv2_plugins = [ |
| 149 | plugin['cfg'] for plugin in plugins |
| 150 | if plugin['position'] == 'after_conv2' |
| 151 | ] |
| 152 | self.after_conv3_plugins = [ |
| 153 | plugin['cfg'] for plugin in plugins |
| 154 | if plugin['position'] == 'after_conv3' |
| 155 | ] |
| 156 | |
| 157 | if self.style == 'pytorch': |
| 158 | self.conv1_stride = 1 |
| 159 | self.conv2_stride = stride |
| 160 | else: |
| 161 | self.conv1_stride = stride |
| 162 | self.conv2_stride = 1 |
| 163 | |
| 164 | self.norm1_name, norm1 = build_norm_layer(norm_cfg, planes, postfix=1) |
| 165 | self.norm2_name, norm2 = build_norm_layer(norm_cfg, planes, postfix=2) |
nothing calls this directly
no test coverage detected