class_docstr: ResNet model for decoder.
  
  Args:
      block (Type[DecoderBasicBlock | DecoderBottleneck]): Type of block to use in a layer.
      layers (list[int]): List to specify number for blocks per layer.
      zero_init_residual (bool, optional): If true, initializes the last batch norm in each layer to zero.
          Defaults to False.
      groups (int, optional): Number of blocked connections per layer from input channels to output channels.
          Defaults to 1.
      width_per_group (int, optional): Number of layers in each intermediate convolution layer.. Defaults to 64.
      norm_layer (Callable[..., nn.Module] | None, optional): Batch norm layer to use. Defaults to None.
class_docstr_tok: ["ResNet","model","for","decoder",".","Args",":","block","(","Type","[","DecoderBasicBlock","|","DecoderBottleneck","]",")",":","Type","of","block","to","use","in","a","layer",".","layers","(","list","[","int","]",")",":","List","to","specify","number","for","blocks","per","layer",".","zero_init_residual","(","bool",",","optional",")",":","If","true",",","initializes","the","last","batch","norm","in","each","layer","to","zero",".","Defaults","to","False",".","groups","(","int",",","optional",")",":","Number","of","blocked","connections","per","layer","from","input","channels","to","output","channels",".","Defaults","to","1.","width_per_group","(","int",",","optional",")",":","Number","of","layers","in","each","intermediate","convolution","layer","..","Defaults","to","64.","norm_layer","(","Callable","[","...",",","nn.Module","]","|","None",",","optional",")",":","Batch","norm","layer","to","use",".","Defaults","to","None","."]
code: def __init__(
      self,
      block: type[DecoderBasicBlock | DecoderBottleneck],
      layers: list[int],
      zero_init_residual: bool = False,
      groups: int = 1,
      width_per_group: int = 64,
      norm_layer: Callable[..., nn.Module] | None = None,
  ) -> None:
      super().__init__()
      if norm_layer is None:
          norm_layer = nn.BatchNorm2d
      self._norm_layer = norm_layer
  
      self.inplanes = 512 * block.expansion
      self.dilation = 1
      self.groups = groups
      self.base_width = width_per_group
      self.layer1 = self._make_layer(block, 256, layers[0], stride=2)
      self.layer2 = self._make_layer(block, 128, layers[1], stride=2)
      self.layer3 = self._make_layer(block, 64, layers[2], stride=2)
  
      for module in self.modules():
          if isinstance(module, nn.Conv2d):
              nn.init.kaiming_normal_(
                  module.weight, mode="fan_out", nonlinearity="relu"
              )
          elif isinstance(module, (nn.BatchNorm2d, nn.GroupNorm)):
              nn.init.constant_(module.weight, 1)
              nn.init.constant_(module.bias, 0)
  
      # Zero-initialize the last BN in each residual branch,
      # so that the residual branch starts with zeros, and each residual block behaves like an identity.
      # This improves the model by 0.2~0.3% according to https://arxiv.org/abs/1706.02677
      if zero_init_residual:
          for module in self.modules():
              if isinstance(module, DecoderBottleneck):
                  nn.init.constant_(module.bn3.weight, 0)  # type: ignore[arg-type]
              elif isinstance(module, DecoderBasicBlock):
                  nn.init.constant_(module.bn2.weight, 0)
  
imports: from __future__ import annotations
  from typing import Any, Callable
  from torch import Tensor, nn
  from torchvision.models.resnet import conv1x1, conv3x3
label_desc: Use image node_id 1 to create a new ResNet object from inherited base classes: nn with example: obj = ResNet(block, layers, zero_init_residual, groups, width_per_group, norm_layer)