class_docstr: Bottleneck building block for ResNet50, ResNet101 and ResNet152.
  
  Parameters
  ----------
  inplanes : int.
      Input channels of each block.
  planes : int.
      Output channels of each block.
  spatial_stride : int, default is 1.
      Stride in spatial dimension of convolutional layers in a block.
  temporal_stride : int, default is 1.
      Stride in temporal dimension of convolutional layers in a block.
  dilation : int, default is 1.
      Dilation of convolutional layers in a block.
  downsample : bool.
      Whether to contain a downsampling layer in the block.
  if_inflate : bool.
      Whether enable inflation of 3D convolutional layers in this block.
  inflate_style : str, default is '3x1x1'.
      How to inflate a 2D kernel, either '3x1x1' or '1x3x3'.
  if_nonlocal : bool.
      Whether to insert a non-local block after this ResNet block.
  nonlocal_cfg : dict.
      Additional `non-local` arguments, for example `nonlocal_type='gaussian'`.
  norm_layer : object
      Normalization layer used (default: :class:`mxnet.gluon.nn.BatchNorm`)
      Can be :class:`mxnet.gluon.nn.BatchNorm` or :class:`mxnet.gluon.contrib.nn.SyncBatchNorm`.
  norm_kwargs : dict
      Additional `norm_layer` arguments, for example `num_devices=4`
      for :class:`mxnet.gluon.contrib.nn.SyncBatchNorm`.
  layer_name : str, default is ''.
      Give a name to current block.
class_docstr_tok: ["Bottleneck","building","block","for","ResNet50",",","ResNet101","and","ResNet152",".","Parameters","--","--","--","--","--","inplanes",":","int",".","Input","channels","of","each","block",".","planes",":","int",".","Output","channels","of","each","block",".","spatial_stride",":","int",",","default","is","1",".","Stride","in","spatial","dimension","of","convolutional","layers","in","a","block",".","temporal_stride",":","int",",","default","is","1",".","Stride","in","temporal","dimension","of","convolutional","layers","in","a","block",".","dilation",":","int",",","default","is","1",".","Dilation","of","convolutional","layers","in","a","block",".","downsample",":","bool",".","Whether","to","contain","a","downsampling","layer","in","the","block",".","if_inflate",":","bool",".","Whether","enable","inflation","of","3D","convolutional","layers","in","this","block",".","inflate_style",":","str",",","default","is","'3x1x1","'",".","How","to","inflate","a","2D","kernel",",","either","'3x1x1","'","or","'1x3x3","'",".","if_nonlocal",":","bool",".","Whether","to","insert","a","non-local","block","after","this","ResNet","block",".","nonlocal_cfg",":","dict",".","Additional","`","non-local","`","arguments",",","for","example","`","nonlocal_type='gaussian","'","`",".","norm_layer",":","object","Normalization","layer","used","(","default",":",":","class",":","`","mxnet.gluon.nn.BatchNorm","`",")","Can","be",":","class",":","`","mxnet.gluon.nn.BatchNorm","`","or",":","class",":","`","mxnet.gluon.contrib.nn.SyncBatchNorm","`",".","norm_kwargs",":","dict","Additional","`","norm_layer","`","arguments",",","for","example","`","num_devices=4","`","for",":","class",":","`","mxnet.gluon.contrib.nn.SyncBatchNorm","`",".","layer_name",":","str",",","default","is","``",".","Give","a","name","to","current","block","."]
code: def __init__(
      self,
      inplanes,
      planes,
      spatial_stride=1,
      temporal_stride=1,
      dilation=1,
      downsample=None,
      if_inflate=True,
      inflate_style="3x1x1",
      if_nonlocal=True,
      nonlocal_cfg=None,
      norm_layer=BatchNorm,
      norm_kwargs=None,
      layer_name="",
      **kwargs,
  ):
      super(Bottleneck, self).__init__()
      assert inflate_style in ["3x1x1", "3x3x3"]
      self.inplanes = inplanes
      self.planes = planes
  
      self.bottleneck = nn.HybridSequential(prefix=layer_name)
      with self.bottleneck.name_scope():
          self.conv1_stride = 1
          self.conv2_stride = spatial_stride
          self.conv1_stride_t = 1
          self.conv2_stride_t = temporal_stride
  
          if if_inflate:
              if inflate_style == "3x1x1":
                  self.conv1 = nn.Conv3D(
                      in_channels=inplanes,
                      channels=planes,
                      kernel_size=(3, 1, 1),
                      strides=(
                          self.conv1_stride_t,
                          self.conv1_stride,
                          self.conv1_stride,
                      ),
                      padding=(1, 0, 0),
                      use_bias=False,
                  )
                  self.conv2 = nn.Conv3D(
                      in_channels=planes,
                      channels=planes,
                      kernel_size=(1, 3, 3),
                      strides=(
                          self.conv2_stride_t,
                          self.conv2_stride,
                          self.conv2_stride,
                      ),
                      padding=(0, dilation, dilation),
                      dilation=(1, dilation, dilation),
                      use_bias=False,
                  )
              else:
                  self.conv1 = nn.Conv3D(
                      in_channels=inplanes,
                      channels=planes,
                      kernel_size=1,
                      strides=(
                          self.conv1_stride_t,
                          self.conv1_stride,
                          self.conv1_stride,
                      ),
                      use_bias=False,
                  )
                  self.conv2 = nn.Conv3D(
                      in_channels=planes,
                      channels=planes,
                      kernel_size=3,
                      strides=(
                          self.conv2_stride_t,
                          self.conv2_stride,
                          self.conv2_stride,
                      ),
                      padding=(1, dilation, dilation),
                      dilation=(1, dilation, dilation),
                      use_bias=False,
                  )
          else:
              self.conv1 = nn.Conv3D(
                  in_channels=inplanes,
                  channels=planes,
                  kernel_size=1,
                  strides=(1, self.conv1_stride, self.conv1_stride),
                  use_bias=False,
              )
              self.conv2 = nn.Conv3D(
                  in_channels=planes,
                  channels=planes,
                  kernel_size=(1, 3, 3),
                  strides=(1, self.conv2_stride, self.conv2_stride),
                  padding=(0, dilation, dilation),
                  dilation=(1, dilation, dilation),
                  use_bias=False,
              )
  
          self.bn1 = norm_layer(
              in_channels=planes,
              **({} if norm_kwargs is None else norm_kwargs),
          )
          self.bn2 = norm_layer(
              in_channels=planes,
              **({} if norm_kwargs is None else norm_kwargs),
          )
          self.conv3 = nn.Conv3D(
              in_channels=planes,
              channels=planes * self.expansion,
              kernel_size=1,
              use_bias=False,
          )
          self.bn3 = norm_layer(
              in_channels=planes * self.expansion,
              **({} if norm_kwargs is None else norm_kwargs),
          )
          self.relu = nn.Activation("relu")
          self.downsample = downsample
  
          self.bottleneck.add(self.conv1)
          self.bottleneck.add(self.bn1)
          self.bottleneck.add(self.relu)
          self.bottleneck.add(self.conv2)
          self.bottleneck.add(self.bn2)
          self.bottleneck.add(self.relu)
          self.bottleneck.add(self.conv3)
          self.bottleneck.add(self.bn3)
  
          self.spatial_tride = spatial_stride
          self.temporal_tride = temporal_stride
          self.dilation = dilation
  
          if if_nonlocal and nonlocal_cfg is not None:
              nonlocal_cfg_ = nonlocal_cfg.copy()
              nonlocal_cfg_["in_channels"] = planes * self.expansion
              self.nonlocal_block = build_nonlocal_block(nonlocal_cfg_)
              self.bottleneck.add(self.nonlocal_block)
          else:
              self.nonlocal_block = None
  
imports: from mxnet import nd
  from mxnet import init
  from mxnet.context import cpu
  from mxnet.gluon.block import HybridBlock
  from mxnet.gluon import nn
  from mxnet.gluon.nn import BatchNorm
  from ..resnetv1b import resnet50_v1b, resnet101_v1b
  from .non_local import build_nonlocal_block
label_desc: Use image node_id 1 to create a new Bottleneck object from inherited base classes: HybridBlock with example: obj = Bottleneck(inplanes, planes, spatial_stride, temporal_stride, dilation, downsample, if_inflate, inflate_style, if_nonlocal, nonlocal_cfg, norm_layer, norm_kwargs, layer_name)