class_docstr: Residual Block
class_docstr_tok: ["Residual","Block"]
code: def __init__(
      self,
      n_layers,
      in_channels,
      mid_channels,
      out_channels,
      stride,
      dilation,
      mg=None,
  ):
      super(_ResBlock, self).__init__()
  
      if mg is None:
          mg = [1 for _ in range(n_layers)]
      else:
          if n_layers != len(mg):
              raise AssertionError(
                  "{} values expected, but got: mg={}".format(
                      n_layers, mg
                  )
              )
  
      self.add_module(
          "block1",
          _Bottleneck(
              in_channels,
              mid_channels,
              out_channels,
              stride,
              dilation * mg[0],
              True,
          ),
      )
      for i, g in zip(range(2, n_layers + 1), mg[1:]):
          self.add_module(
              "block" + str(i),
              _Bottleneck(
                  out_channels,
                  mid_channels,
                  out_channels,
                  1,
                  dilation * g,
                  False,
              ),
          )
  
file_path: pywick/pywick/models/segmentation/testnets/resnet.py
imports: from collections import OrderedDict
  import torch
  import torch.nn
  import torch.nn.functional
  import torch.utils.model_zoo
label_desc: Use image node_id 1 to create a new _ResBlock object from inherited base classes: nn with example: obj = _ResBlock(n_layers, in_channels, mid_channels, out_channels, stride, dilation, mg)