class_docstr: Basic block for decoder ResNet architecture.
  
  Args:
      inplanes (int): Number of input channels.
      planes (int): Number of output channels.
      stride (int, optional): Stride for convolution and de-convolution layers. Defaults to 1.
      upsample (nn.Module | None, optional): Module used for upsampling output. Defaults to None.
      groups (int, optional): Number of blocked connections from input channels to output channels.
          Defaults to 1.
      base_width (int, optional): Number of layers in each intermediate convolution layer. Defaults to 64.
      dilation (int, optional): Spacing between kernel elements. Defaults to 1.
      norm_layer (Callable[..., nn.Module] | None, optional): Batch norm layer to use.Defaults to None.
  
  Raises:
      ValueError: If groups are not equal to 1 and base width is not 64.
      NotImplementedError: If dilation is greater than 1.
class_docstr_tok: ["Basic","block","for","decoder","ResNet","architecture",".","Args",":","inplanes","(","int",")",":","Number","of","input","channels",".","planes","(","int",")",":","Number","of","output","channels",".","stride","(","int",",","optional",")",":","Stride","for","convolution","and","de-convolution","layers",".","Defaults","to","1.","upsample","(","nn.Module","|","None",",","optional",")",":","Module","used","for","upsampling","output",".","Defaults","to","None",".","groups","(","int",",","optional",")",":","Number","of","blocked","connections","from","input","channels","to","output","channels",".","Defaults","to","1.","base_width","(","int",",","optional",")",":","Number","of","layers","in","each","intermediate","convolution","layer",".","Defaults","to","64.","dilation","(","int",",","optional",")",":","Spacing","between","kernel","elements",".","Defaults","to","1.","norm_layer","(","Callable","[","...",",","nn.Module","]","|","None",",","optional",")",":","Batch","norm","layer","to","use.Defaults","to","None",".","Raises",":","ValueError",":","If","groups","are","not","equal","to","1","and","base","width","is","not","64",".","NotImplementedError",":","If","dilation","is","greater","than","1","."]
code: def __init__(
      self,
      inplanes: int,
      planes: int,
      stride: int = 1,
      upsample: nn.Module | None = None,
      groups: int = 1,
      base_width: int = 64,
      dilation: int = 1,
      norm_layer: Callable[..., nn.Module] | None = None,
  ) -> None:
      super().__init__()
      if norm_layer is None:
          norm_layer = nn.BatchNorm2d
      if groups != 1 or base_width != 64:
          raise ValueError(
              "BasicBlock only supports groups=1 and base_width=64"
          )
      if dilation > 1:
          raise NotImplementedError(
              "Dilation > 1 not supported in BasicBlock"
          )
      # Both self.conv1 and self.downsample layers downsample the input when stride != 2
      if stride == 2:
          self.conv1 = nn.ConvTranspose2d(
              inplanes,
              planes,
              kernel_size=2,
              stride=stride,
              groups=groups,
              bias=False,
              dilation=dilation,
          )
      else:
          self.conv1 = conv3x3(inplanes, planes, stride)
      self.bn1 = norm_layer(planes)
      self.relu = nn.ReLU(inplace=True)
      self.conv2 = conv3x3(planes, planes)
      self.bn2 = norm_layer(planes)
      self.upsample = upsample
      self.stride = stride
  
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 DecoderBasicBlock object from inherited base classes: nn with example: obj = DecoderBasicBlock(inplanes, planes, stride, upsample, groups, base_width, dilation, norm_layer)