class_docstr: Residual block with skip connection.
docstr: ResBlock class constructs redisual blocks. More details can be found in:
      "Deep residual learning for image recognition."
      https://arxiv.org/abs/1512.03385
  Args:
      dim_in (int): the channel dimensions of the input.
      dim_out (int): the channel dimension of the output.
      dim_inner (int): the inner dimension of the block.
      temporal_kernel_size (int): the temporal kernel sizes of the middle
          convolution in the bottleneck.
      temporal_conv_1x1 (bool): Only useful for PostactivatedBottleneckTransformation.
          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.
      stride (int): the stride of the bottleneck.
      skip_transformation_type (str): the type of skip transformation
      residual_transformation_type (str): the type of residual transformation
      num_groups (int): number of groups for the convolution. num_groups=1
          is for standard ResNet like networks, and num_groups>1 is for
          ResNeXt like networks.
      disable_pre_activation (bool): If true, disable the preactivation,
          which includes BatchNorm3D and ReLU.
docstr_tok: ["ResBlock","class","constructs","redisual","blocks",".","More","details","can","be","found","in",":","``","Deep","residual","learning","for","image","recognition",".","''","https",":","\/\/arxiv.org\/abs\/1512.03385","Args",":","dim_in","(","int",")",":","the","channel","dimensions","of","the","input",".","dim_out","(","int",")",":","the","channel","dimension","of","the","output",".","dim_inner","(","int",")",":","the","inner","dimension","of","the","block",".","temporal_kernel_size","(","int",")",":","the","temporal","kernel","sizes","of","the","middle","convolution","in","the","bottleneck",".","temporal_conv_1x1","(","bool",")",":","Only","useful","for","PostactivatedBottleneckTransformation",".","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",".","stride","(","int",")",":","the","stride","of","the","bottleneck",".","skip_transformation_type","(","str",")",":","the","type","of","skip","transformation","residual_transformation_type","(","str",")",":","the","type","of","residual","transformation","num_groups","(","int",")",":","number","of","groups","for","the","convolution",".","num_groups=1","is","for","standard","ResNet","like","networks",",","and","num_groups",">","1","is","for","ResNeXt","like","networks",".","disable_pre_activation","(","bool",")",":","If","true",",","disable","the","preactivation",",","which","includes","BatchNorm3D","and","ReLU","."]
code: def __init__(
      self,
      dim_in,
      dim_out,
      dim_inner,
      temporal_kernel_size,
      temporal_conv_1x1,
      temporal_stride,
      spatial_stride,
      skip_transformation_type,
      residual_transformation_type,
      num_groups=1,
      inplace_relu=True,
      bn_eps=1e-5,
      bn_mmt=0.1,
      disable_pre_activation=False,
  ):
      """
      ResBlock class constructs redisual blocks. More details can be found in:
          "Deep residual learning for image recognition."
          https://arxiv.org/abs/1512.03385
      Args:
          dim_in (int): the channel dimensions of the input.
          dim_out (int): the channel dimension of the output.
          dim_inner (int): the inner dimension of the block.
          temporal_kernel_size (int): the temporal kernel sizes of the middle
              convolution in the bottleneck.
          temporal_conv_1x1 (bool): Only useful for PostactivatedBottleneckTransformation.
              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.
          stride (int): the stride of the bottleneck.
          skip_transformation_type (str): the type of skip transformation
          residual_transformation_type (str): the type of residual transformation
          num_groups (int): number of groups for the convolution. num_groups=1
              is for standard ResNet like networks, and num_groups>1 is for
              ResNeXt like networks.
          disable_pre_activation (bool): If true, disable the preactivation,
              which includes BatchNorm3D and ReLU.
      """
      super(ResBlock, self).__init__()
  
      assert skip_transformation_type in skip_transformations, (
          "unknown skip transformation: %s" % skip_transformation_type
      )
  
      if (
          (dim_in != dim_out)
          or (spatial_stride != 1)
          or (temporal_stride != 1)
      ):
          self.skip = skip_transformations[skip_transformation_type](
              dim_in,
              dim_out,
              temporal_stride,
              spatial_stride,
              bn_eps=bn_eps,
              bn_mmt=bn_mmt,
              disable_pre_activation=disable_pre_activation,
          )
  
      assert residual_transformation_type in residual_transformations, (
          "unknown residual transformation: %s"
          % residual_transformation_type
      )
      self.residual = residual_transformations[
          residual_transformation_type
      ](
          dim_in,
          dim_out,
          temporal_stride,
          spatial_stride,
          num_groups,
          dim_inner,
          temporal_kernel_size=temporal_kernel_size,
          temporal_conv_1x1=temporal_conv_1x1,
          disable_pre_activation=disable_pre_activation,
      )
      self.relu = nn.ReLU(inplace_relu)
  
imports: import torch.nn
  from .r2plus1_util import r2plus1_unit
label_desc: Use image node_id 1 to create a new ResBlock object from inherited base classes: nn with example: obj = ResBlock(dim_in, dim_out, dim_inner, temporal_kernel_size, temporal_conv_1x1, temporal_stride, spatial_stride, skip_transformation_type, residual_transformation_type, num_groups, inplace_relu, bn_eps, bn_mmt, disable_pre_activation)