docstr: Bottleneck block for ResNet.
  
  If style is "pytorch", the stride-two layer is the 3x3 conv layer, if
  it is "caffe", the stride-two layer is the first 1x1 conv layer.
docstr_tok: ["Bottleneck","block","for","ResNet",".","If","style","is","``","pytorch","''",",","the","stride-two","layer","is","the","3x3","conv","layer",",","if","it","is","``","caffe","''",",","the","stride-two","layer","is","the","first","1x1","conv","layer","."]
code: def __init__(
      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,
  ):
      """Bottleneck block for ResNet.
  
      If style is "pytorch", the stride-two layer is the 3x3 conv layer, if
      it is "caffe", the stride-two layer is the first 1x1 conv layer.
      """
      super(Bottleneck, self).__init__()
      assert style in ["pytorch", "caffe"]
      assert dcn is None or isinstance(dcn, dict)
      assert plugins is None or isinstance(plugins, list)
      if plugins is not None:
          allowed_position = [
              "after_conv1",
              "after_conv2",
              "after_conv3",
          ]
          assert all(p["position"] in allowed_position for p in plugins)
  
      self.inplanes = inplanes
      self.planes = planes
      self.stride = stride
      self.dilation = dilation
      self.style = style
      self.with_cp = with_cp
      self.conv_cfg = conv_cfg
      self.norm_cfg = norm_cfg
      self.dcn = dcn
      self.with_dcn = dcn is not None
      self.plugins = plugins
      self.with_plugins = plugins is not None
  
      if self.with_plugins:
          # collect plugins for conv1/conv2/conv3
          self.after_conv1_plugins = [
              plugin["cfg"]
              for plugin in plugins
              if plugin["position"] == "after_conv1"
          ]
          self.after_conv2_plugins = [
              plugin["cfg"]
              for plugin in plugins
              if plugin["position"] == "after_conv2"
          ]
          self.after_conv3_plugins = [
              plugin["cfg"]
              for plugin in plugins
              if plugin["position"] == "after_conv3"
          ]
  
      if self.style == "pytorch":
          self.conv1_stride = 1
          self.conv2_stride = stride
      else:
          self.conv1_stride = stride
          self.conv2_stride = 1
  
      self.norm1_name, norm1 = build_norm_layer(
          norm_cfg, planes, postfix=1
      )
      self.norm2_name, norm2 = build_norm_layer(
          norm_cfg, planes, postfix=2
      )
      self.norm3_name, norm3 = build_norm_layer(
          norm_cfg, planes * self.expansion, postfix=3
      )
  
      self.conv1 = build_conv_layer(
          conv_cfg,
          inplanes,
          planes,
          kernel_size=1,
          stride=self.conv1_stride,
          bias=False,
      )
      self.add_module(self.norm1_name, norm1)
      fallback_on_stride = False
      if self.with_dcn:
          fallback_on_stride = dcn.pop("fallback_on_stride", False)
      if not self.with_dcn or fallback_on_stride:
          self.conv2 = build_conv_layer(
              conv_cfg,
              planes,
              planes,
              kernel_size=3,
              stride=self.conv2_stride,
              padding=dilation,
              dilation=dilation,
              bias=False,
          )
      else:
          assert self.conv_cfg is None, "conv_cfg must be None for DCN"
          self.conv2 = build_conv_layer(
              dcn,
              planes,
              planes,
              kernel_size=3,
              stride=self.conv2_stride,
              padding=dilation,
              dilation=dilation,
              bias=False,
          )
  
      self.add_module(self.norm2_name, norm2)
      self.conv3 = build_conv_layer(
          conv_cfg,
          planes,
          planes * self.expansion,
          kernel_size=1,
          bias=False,
      )
      self.add_module(self.norm3_name, norm3)
  
      self.relu = nn.ReLU(inplace=True)
      self.downsample = downsample
  
      if self.with_plugins:
          self.after_conv1_plugin_names = self.make_block_plugins(
              planes, self.after_conv1_plugins
          )
          self.after_conv2_plugin_names = self.make_block_plugins(
              planes, self.after_conv2_plugins
          )
          self.after_conv3_plugin_names = self.make_block_plugins(
              planes * self.expansion, self.after_conv3_plugins
          )
  
imports: import torch.nn
  import torch.utils.checkpoint
  from mmcv.cnn import build_conv_layer, build_norm_layer, build_plugin_layer, constant_init, kaiming_init
  from mmcv.runner import load_checkpoint
  from torch.nn.modules.batchnorm import _BatchNorm
  from mmdet.utils import get_root_logger
  from ..builder import BACKBONES
  from ..utils import ResLayer
label_desc: Use image node_id 1 to create a new Bottleneck object from inherited base classes: nn with example: obj = Bottleneck(inplanes, planes, stride, dilation, downsample, style, with_cp, conv_cfg, norm_cfg, dcn, plugins)