class_docstr: Bottleneck transformation: Tx1x1, 1x3x3, 1x1x1, where T is the size of
      temporal kernel.
docstr: Args:
      dim_in (int): the channel dimensions of the input.
      dim_out (int): the channel dimension of the output.
      temporal_kernel_size (int): the temporal kernel sizes of the middle
          convolution in the bottleneck.
      temporal_conv_1x1 (bool): if True, do temporal convolution in the fist
          1x1 Conv3d. Otherwise, do it in the second 3x3 Conv3d
      temporal_stride (int): the temporal stride of the bottleneck.
      spatial_stride (int): the spatial_stride of the bottleneck.
      num_groups (int): number of groups for the convolution.
      dim_inner (int): the inner dimension of the block.
          is for standard ResNet like networks, and num_groups>1 is for
          ResNeXt like networks.
      spatial_stride_1x1 (bool): if True, apply spatial_stride to 1x1 conv.
      inplace_relu (bool): calculate the relu on the original input
          without allocating new memory.
      bn_eps (float): epsilon for batch norm.
      bn_mmt (float): momentum for batch norm. Noted that BN momentum in
          PyTorch = 1 - BN momentum in Caffe2.
docstr_tok: ["Args",":","dim_in","(","int",")",":","the","channel","dimensions","of","the","input",".","dim_out","(","int",")",":","the","channel","dimension","of","the","output",".","temporal_kernel_size","(","int",")",":","the","temporal","kernel","sizes","of","the","middle","convolution","in","the","bottleneck",".","temporal_conv_1x1","(","bool",")",":","if","True",",","do","temporal","convolution","in","the","fist","1x1","Conv3d",".","Otherwise",",","do","it","in","the","second","3x3","Conv3d","temporal_stride","(","int",")",":","the","temporal","stride","of","the","bottleneck",".","spatial_stride","(","int",")",":","the","spatial_stride","of","the","bottleneck",".","num_groups","(","int",")",":","number","of","groups","for","the","convolution",".","dim_inner","(","int",")",":","the","inner","dimension","of","the","block",".","is","for","standard","ResNet","like","networks",",","and","num_groups",">","1","is","for","ResNeXt","like","networks",".","spatial_stride_1x1","(","bool",")",":","if","True",",","apply","spatial_stride","to","1x1","conv",".","inplace_relu","(","bool",")",":","calculate","the","relu","on","the","original","input","without","allocating","new","memory",".","bn_eps","(","float",")",":","epsilon","for","batch","norm",".","bn_mmt","(","float",")",":","momentum","for","batch","norm",".","Noted","that","BN","momentum","in","PyTorch","=","1","-","BN","momentum","in","Caffe2","."]
code: def __init__(
      self,
      dim_in,
      dim_out,
      temporal_stride,
      spatial_stride,
      num_groups,
      dim_inner,
      temporal_kernel_size=3,
      temporal_conv_1x1=True,
      spatial_stride_1x1=False,
      inplace_relu=True,
      bn_eps=1e-5,
      bn_mmt=0.1,
      **kwargs,
  ):
      """
      Args:
          dim_in (int): the channel dimensions of the input.
          dim_out (int): the channel dimension of the output.
          temporal_kernel_size (int): the temporal kernel sizes of the middle
              convolution in the bottleneck.
          temporal_conv_1x1 (bool): if True, do temporal convolution in the fist
              1x1 Conv3d. Otherwise, do it in the second 3x3 Conv3d
          temporal_stride (int): the temporal stride of the bottleneck.
          spatial_stride (int): the spatial_stride of the bottleneck.
          num_groups (int): number of groups for the convolution.
          dim_inner (int): the inner dimension of the block.
              is for standard ResNet like networks, and num_groups>1 is for
              ResNeXt like networks.
          spatial_stride_1x1 (bool): if True, apply spatial_stride to 1x1 conv.
          inplace_relu (bool): calculate the relu on the original input
              without allocating new memory.
          bn_eps (float): epsilon for batch norm.
          bn_mmt (float): momentum for batch norm. Noted that BN momentum in
              PyTorch = 1 - BN momentum in Caffe2.
      """
      super(PostactivatedBottleneckTransformation, self).__init__()
      (temporal_kernel_size_1x1, temporal_kernel_size_3x3) = (
          (temporal_kernel_size, 1)
          if temporal_conv_1x1
          else (1, temporal_kernel_size)
      )
      # MSRA -> stride=2 is on 1x1; TH/C2 -> stride=2 is on 3x3.
      (str1x1, str3x3) = (
          (spatial_stride, 1)
          if spatial_stride_1x1
          else (1, spatial_stride)
      )
      # Tx1x1 conv, BN, ReLU.
      self.branch2a = nn.Conv3d(
          dim_in,
          dim_inner,
          kernel_size=[temporal_kernel_size_1x1, 1, 1],
          stride=[1, str1x1, str1x1],
          padding=[temporal_kernel_size_1x1 // 2, 0, 0],
          bias=False,
      )
      self.branch2a_bn = nn.BatchNorm3d(
          dim_inner, eps=bn_eps, momentum=bn_mmt
      )
      self.branch2a_relu = nn.ReLU(inplace=inplace_relu)
      # Tx3x3 group conv, BN, ReLU.
      self.branch2b = nn.Conv3d(
          dim_inner,
          dim_inner,
          [temporal_kernel_size_3x3, 3, 3],
          stride=[temporal_stride, str3x3, str3x3],
          padding=[temporal_kernel_size_3x3 // 2, 1, 1],
          groups=num_groups,
          bias=False,
      )
      self.branch2b_bn = nn.BatchNorm3d(
          dim_inner, eps=bn_eps, momentum=bn_mmt
      )
      self.branch2b_relu = nn.ReLU(inplace=inplace_relu)
      # 1x1x1 conv, BN.
      self.branch2c = nn.Conv3d(
          dim_inner,
          dim_out,
          kernel_size=[1, 1, 1],
          stride=[1, 1, 1],
          padding=[0, 0, 0],
          bias=False,
      )
      self.branch2c_bn = nn.BatchNorm3d(
          dim_out, eps=bn_eps, momentum=bn_mmt
      )
      self.branch2c_bn.final_transform_op = True
  
imports: import torch.nn
  from .r2plus1_util import r2plus1_unit
label_desc: Use image node_id 1 to create a new PostactivatedBottleneckTransformation object from inherited base classes: nn with example: obj = PostactivatedBottleneckTransformation(dim_in, dim_out, temporal_stride, spatial_stride, num_groups, dim_inner, temporal_kernel_size, temporal_conv_1x1, spatial_stride_1x1, inplace_relu, bn_eps, bn_mmt)