class_docstr: Residual block.
class_docstr_tok: ["Residual","block","."]
docstr: ResBlock class constructs redisual blocks. More details can be found in:
      Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun.
      "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.
      temp_kernel_size (int): the temporal kernel sizes of the middle
          convolution in the bottleneck.
      stride (int): the stride of the bottleneck.
      trans_func (string): transform function to be used to construct the
          bottleneck.
      dim_inner (int): the inner dimension of the block.
      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.
      stride_1x1 (bool): if True, apply stride to 1x1 conv, otherwise
          apply stride to the 3x3 conv.
      inplace_relu (bool): calculate the relu on the original input
          without allocating new memory.
      eps (float): epsilon for batch norm.
      bn_mmt (float): momentum for batch norm. Noted that BN momentum in
          PyTorch = 1 - BN momentum in Caffe2.
      dilation (int): size of dilation.
      norm_module (nn.Module): nn.Module for the normalization layer. The
          default is nn.BatchNorm3d.
      drop_connect_rate (float): basic rate at which blocks are dropped,
          linearly increases from input to output blocks.
docstr_tok: ["ResBlock","class","constructs","redisual","blocks",".","More","details","can","be","found","in",":","Kaiming","He",",","Xiangyu","Zhang",",","Shaoqing","Ren",",","and","Jian","Sun",".","``","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",".","temp_kernel_size","(","int",")",":","the","temporal","kernel","sizes","of","the","middle","convolution","in","the","bottleneck",".","stride","(","int",")",":","the","stride","of","the","bottleneck",".","trans_func","(","string",")",":","transform","function","to","be","used","to","construct","the","bottleneck",".","dim_inner","(","int",")",":","the","inner","dimension","of","the","block",".","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",".","stride_1x1","(","bool",")",":","if","True",",","apply","stride","to","1x1","conv",",","otherwise","apply","stride","to","the","3x3","conv",".","inplace_relu","(","bool",")",":","calculate","the","relu","on","the","original","input","without","allocating","new","memory",".","eps","(","float",")",":","epsilon","for","batch","norm",".","bn_mmt","(","float",")",":","momentum","for","batch","norm",".","Noted","that","BN","momentum","in","PyTorch","=","1","-","BN","momentum","in","Caffe2",".","dilation","(","int",")",":","size","of","dilation",".","norm_module","(","nn.Module",")",":","nn.Module","for","the","normalization","layer",".","The","default","is","nn.BatchNorm3d",".","drop_connect_rate","(","float",")",":","basic","rate","at","which","blocks","are","dropped",",","linearly","increases","from","input","to","output","blocks","."]
code: def __init__(
      self,
      dim_in,
      dim_out,
      temp_kernel_size,
      stride,
      trans_func,
      dim_inner,
      num_groups=1,
      stride_1x1=False,
      inplace_relu=True,
      eps=1e-5,
      bn_mmt=0.1,
      dilation=1,
      norm_module=nn.BatchNorm3d,
      block_idx=0,
      drop_connect_rate=0.0,
  ):
      """
      ResBlock class constructs redisual blocks. More details can be found in:
          Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun.
          "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.
          temp_kernel_size (int): the temporal kernel sizes of the middle
              convolution in the bottleneck.
          stride (int): the stride of the bottleneck.
          trans_func (string): transform function to be used to construct the
              bottleneck.
          dim_inner (int): the inner dimension of the block.
          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.
          stride_1x1 (bool): if True, apply stride to 1x1 conv, otherwise
              apply stride to the 3x3 conv.
          inplace_relu (bool): calculate the relu on the original input
              without allocating new memory.
          eps (float): epsilon for batch norm.
          bn_mmt (float): momentum for batch norm. Noted that BN momentum in
              PyTorch = 1 - BN momentum in Caffe2.
          dilation (int): size of dilation.
          norm_module (nn.Module): nn.Module for the normalization layer. The
              default is nn.BatchNorm3d.
          drop_connect_rate (float): basic rate at which blocks are dropped,
              linearly increases from input to output blocks.
      """
      super(ResBlock, self).__init__()
      self._inplace_relu = inplace_relu
      self._eps = eps
      self._bn_mmt = bn_mmt
      self._drop_connect_rate = drop_connect_rate
      self._construct(
          dim_in,
          dim_out,
          temp_kernel_size,
          stride,
          trans_func,
          dim_inner,
          num_groups,
          stride_1x1,
          inplace_relu,
          dilation,
          norm_module,
          block_idx,
      )
  
imports: import torch
  import torch.nn
  from slowfast.models.common import drop_path
  from slowfast.models.nonlocal_helper import Nonlocal
  from slowfast.models.operators import SE, Swish
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, temp_kernel_size, stride, trans_func, dim_inner, num_groups, stride_1x1, inplace_relu, eps, bn_mmt, dilation, norm_module, block_idx, drop_connect_rate)