class_docstr: UNet Decoder.
  This class refers to `segmentation_models.pytorch
  <https://github.com/qubvel/segmentation_models.pytorch>`_.
  
  Args:
      spatial_dims: number of spatial dimensions.
      encoder_channels: number of output channels for all feature maps in encoder.
          `len(encoder_channels)` should be no less than 2.
      decoder_channels: number of output channels for all feature maps in decoder.
          `len(decoder_channels)` should equal to `len(encoder_channels) - 1`.
      act: activation type and arguments.
      norm: feature normalization type and arguments.
      dropout: dropout ratio.
      bias: whether to have a bias term in convolution blocks in this decoder.
      upsample: upsampling mode, available options are
          ``"deconv"``, ``"pixelshuffle"``, ``"nontrainable"``.
      pre_conv: a conv block applied before upsampling.
          Only used in the "nontrainable" or "pixelshuffle" mode.
      interp_mode: {``"nearest"``, ``"linear"``, ``"bilinear"``, ``"bicubic"``, ``"trilinear"``}
          Only used in the "nontrainable" mode.
      align_corners: set the align_corners parameter for upsample. Defaults to True.
          Only used in the "nontrainable" mode.
      is_pad: whether to pad upsampling features to fit the encoder spatial dims.
class_docstr_tok: ["UNet","Decoder",".","This","class","refers","to","`","segmentation_models.pytorch","<","https",":","\/\/github.com\/qubvel\/segmentation_models.pytorch",">","`","_",".","Args",":","spatial_dims",":","number","of","spatial","dimensions",".","encoder_channels",":","number","of","output","channels","for","all","feature","maps","in","encoder",".","`","len","(","encoder_channels",")","`","should","be","no","less","than","2.","decoder_channels",":","number","of","output","channels","for","all","feature","maps","in","decoder",".","`","len","(","decoder_channels",")","`","should","equal","to","`","len","(","encoder_channels",")","-","1","`",".","act",":","activation","type","and","arguments",".","norm",":","feature","normalization","type","and","arguments",".","dropout",":","dropout","ratio",".","bias",":","whether","to","have","a","bias","term","in","convolution","blocks","in","this","decoder",".","upsample",":","upsampling","mode",",","available","options","are","``","``","deconv","''","``",",","``","``","pixelshuffle","''","``",",","``","``","nontrainable","''","``",".","pre_conv",":","a","conv","block","applied","before","upsampling",".","Only","used","in","the","``","nontrainable","''","or","``","pixelshuffle","''","mode",".","interp_mode",":","{","``","``","nearest","''","``",",","``","``","linear","''","``",",","``","``","bilinear","''","``",",","``","``","bicubic","''","``",",","``","``","trilinear","''","``","}","Only","used","in","the","``","nontrainable","''","mode",".","align_corners",":","set","the","align_corners","parameter","for","upsample",".","Defaults","to","True",".","Only","used","in","the","``","nontrainable","''","mode",".","is_pad",":","whether","to","pad","upsampling","features","to","fit","the","encoder","spatial","dims","."]
code: def __init__(
      self,
      spatial_dims: int,
      encoder_channels: Sequence[int],
      decoder_channels: Sequence[int],
      act: str | tuple,
      norm: str | tuple,
      dropout: float | tuple,
      bias: bool,
      upsample: str,
      pre_conv: str | None,
      interp_mode: str,
      align_corners: bool | None,
      is_pad: bool,
  ):
      super().__init__()
      if len(encoder_channels) < 2:
          raise ValueError(
              "the length of `encoder_channels` should be no less than 2."
          )
      if len(decoder_channels) != len(encoder_channels) - 1:
          raise ValueError(
              "`len(decoder_channels)` should equal to `len(encoder_channels) - 1`."
          )
  
      in_channels = [encoder_channels[-1]] + list(decoder_channels[:-1])
      skip_channels = list(encoder_channels[1:-1][::-1]) + [0]
      halves = [True] * (len(skip_channels) - 1)
      halves.append(False)
      blocks = []
      for in_chn, skip_chn, out_chn, halve in zip(
          in_channels, skip_channels, decoder_channels, halves
      ):
          blocks.append(
              UpCat(
                  spatial_dims=spatial_dims,
                  in_chns=in_chn,
                  cat_chns=skip_chn,
                  out_chns=out_chn,
                  act=act,
                  norm=norm,
                  dropout=dropout,
                  bias=bias,
                  upsample=upsample,
                  pre_conv=pre_conv,
                  interp_mode=interp_mode,
                  align_corners=align_corners,
                  halves=halve,
                  is_pad=is_pad,
              )
          )
      self.blocks = nn.ModuleList(blocks)
  
imports: from __future__ import annotations
  import warnings
  from collections.abc import Sequence
  from pydoc import locate
  from typing import Any
  import torch
  from torch import nn
  from monai.networks.blocks import BaseEncoder, UpSample
  from monai.networks.layers.factories import Conv
  from monai.networks.layers.utils import get_act_layer
  from monai.networks.nets import EfficientNetEncoder
  from monai.networks.nets.basic_unet import UpCat
  from monai.utils import InterpolateMode, optional_import
label_desc: Use image node_id 1 to create a new UNetDecoder object from inherited base classes: nn with example: obj = UNetDecoder(spatial_dims, encoder_channels, decoder_channels, act, norm, dropout, bias, upsample, pre_conv, interp_mode, align_corners, is_pad)