class_docstr: This reimplementation of a dynamic UNet (DynUNet) is based on:
  `Automated Design of Deep Learning Methods for Biomedical Image Segmentation <https://arxiv.org/abs/1904.08128>`_.
  `nnU-Net: Self-adapting Framework for U-Net-Based Medical Image Segmentation <https://arxiv.org/abs/1809.10486>`_.
  `Optimized U-Net for Brain Tumor Segmentation <https://arxiv.org/pdf/2110.03352.pdf>`_.
  
  This model is more flexible compared with ``monai.networks.nets.UNet`` in three
  places:
  
      - Residual connection is supported in conv blocks.
      - Anisotropic kernel sizes and strides can be used in each layers.
      - Deep supervision heads can be added.
  
  The model supports 2D or 3D inputs and is consisted with four kinds of blocks:
  one input block, `n` downsample blocks, one bottleneck and `n+1` upsample blocks. Where, `n>0`.
  The first and last kernel and stride values of the input sequences are used for input block and
  bottleneck respectively, and the rest value(s) are used for downsample and upsample blocks.
  Therefore, pleasure ensure that the length of input sequences (``kernel_size`` and ``strides``)
  is no less than 3 in order to have at least one downsample and upsample blocks.
  
  To meet the requirements of the structure, the input size for each spatial dimension should be divisible
  by the product of all strides in the corresponding dimension. In addition, the minimal spatial size should have
  at least one dimension that has twice the size of the product of all strides.
  For example, if `strides=((1, 2, 4), 2, 2, 1)`, the spatial size should be divisible by `(4, 8, 16)`,
  and the minimal spatial size is `(8, 8, 16)` or `(4, 16, 16)` or `(4, 8, 32)`.
  
  The output size for each spatial dimension equals to the input size of the corresponding dimension divided by the
  stride in strides[0].
  For example, if `strides=((1, 2, 4), 2, 2, 1)` and the input size is `(64, 32, 32)`, the output size is `(64, 16, 8)`.
  
  For backwards compatibility with old weights, please set `strict=False` when calling `load_state_dict`.
  
  Usage example with medical segmentation decathlon dataset is available at:
  https://github.com/Project-MONAI/tutorials/tree/master/modules/dynunet_pipeline.
  
  Args:
      spatial_dims: number of spatial dimensions.
      in_channels: number of input channels.
      out_channels: number of output channels.
      kernel_size: convolution kernel size.
      strides: convolution strides for each blocks.
      upsample_kernel_size: convolution kernel size for transposed convolution layers. The values should
          equal to strides[1:].
      filters: number of output channels for each blocks. Different from nnU-Net, in this implementation we add
          this argument to make the network more flexible. As shown in the third reference, one way to determine
          this argument is like:
          ``[64, 96, 128, 192, 256, 384, 512, 768, 1024][: len(strides)]``.
          The above way is used in the network that wins task 1 in the BraTS21 Challenge.
          If not specified, the way which nnUNet used will be employed. Defaults to ``None``.
      dropout: dropout ratio. Defaults to no dropout.
      norm_name: feature normalization type and arguments. Defaults to ``INSTANCE``.
          `INSTANCE_NVFUSER` is a faster version of the instance norm layer, it can be used when:
          1) `spatial_dims=3`, 2) CUDA device is available, 3) `apex` is installed and 4) non-Windows OS is used.
      act_name: activation layer type and arguments. Defaults to ``leakyrelu``.
      deep_supervision: whether to add deep supervision head before output. Defaults to ``False``.
          If ``True``, in training mode, the forward function will output not only the final feature map
          (from `output_block`), but also the feature maps that come from the intermediate up sample layers.
          In order to unify the return type (the restriction of TorchScript), all intermediate
          feature maps are interpolated into the same size as the final feature map and stacked together
          (with a new dimension in the first axis)into one single tensor.
          For instance, if there are two intermediate feature maps with shapes: (1, 2, 16, 12) and
          (1, 2, 8, 6), and the final feature map has the shape (1, 2, 32, 24), then all intermediate feature maps
          will be interpolated into (1, 2, 32, 24), and the stacked tensor will has the shape (1, 3, 2, 32, 24).
          When calculating the loss, you can use torch.unbind to get all feature maps can compute the loss
          one by one with the ground truth, then do a weighted average for all losses to achieve the final loss.
      deep_supr_num: number of feature maps that will output during deep supervision head. The
          value should be larger than 0 and less than the number of up sample layers.
          Defaults to 1.
      res_block: whether to use residual connection based convolution blocks during the network.
          Defaults to ``False``.
      trans_bias: whether to set the bias parameter in transposed convolution layers. Defaults to ``False``.
class_docstr_tok: ["This","reimplementation","of","a","dynamic","UNet","(","DynUNet",")","is","based","on",":","`","Automated","Design","of","Deep","Learning","Methods","for","Biomedical","Image","Segmentation","<","https",":","\/\/arxiv.org\/abs\/1904.08128",">","`","_",".","`","nnU-Net",":","Self-adapting","Framework","for","U-Net-Based","Medical","Image","Segmentation","<","https",":","\/\/arxiv.org\/abs\/1809.10486",">","`","_",".","`","Optimized","U-Net","for","Brain","Tumor","Segmentation","<","https",":","\/\/arxiv.org\/pdf\/2110.03352.pdf",">","`","_",".","This","model","is","more","flexible","compared","with","``","monai.networks.nets.UNet","``","in","three","places",":","-","Residual","connection","is","supported","in","conv","blocks",".","-","Anisotropic","kernel","sizes","and","strides","can","be","used","in","each","layers",".","-","Deep","supervision","heads","can","be","added",".","The","model","supports","2D","or","3D","inputs","and","is","consisted","with","four","kinds","of","blocks",":","one","input","block",",","`","n","`","downsample","blocks",",","one","bottleneck","and","`","n+1","`","upsample","blocks",".","Where",",","`","n",">","0","`",".","The","first","and","last","kernel","and","stride","values","of","the","input","sequences","are","used","for","input","block","and","bottleneck","respectively",",","and","the","rest","value","(","s",")","are","used","for","downsample","and","upsample","blocks",".","Therefore",",","pleasure","ensure","that","the","length","of","input","sequences","(","``","kernel_size","``","and","``","strides","``",")","is","no","less","than","3","in","order","to","have","at","least","one","downsample","and","upsample","blocks",".","To","meet","the","requirements","of","the","structure",",","the","input","size","for","each","spatial","dimension","should","be","divisible","by","the","product","of","all","strides","in","the","corresponding","dimension",".","In","addition",",","the","minimal","spatial","size","should","have","at","least","one","dimension","that","has","twice","the","size","of","the","product","of","all","strides",".","For","example",",","if","`","strides=","(","(","1",",","2",",","4",")",",","2",",","2",",","1",")","`",",","the","spatial","size","should","be","divisible","by","`","(","4",",","8",",","16",")","`",",","and","the","minimal","spatial","size","is","`","(","8",",","8",",","16",")","`","or","`","(","4",",","16",",","16",")","`","or","`","(","4",",","8",",","32",")","`",".","The","output","size","for","each","spatial","dimension","equals","to","the","input","size","of","the","corresponding","dimension","divided","by","the","stride","in","strides","[","0","]",".","For","example",",","if","`","strides=","(","(","1",",","2",",","4",")",",","2",",","2",",","1",")","`","and","the","input","size","is","`","(","64",",","32",",","32",")","`",",","the","output","size","is","`","(","64",",","16",",","8",")","`",".","For","backwards","compatibility","with","old","weights",",","please","set","`","strict=False","`","when","calling","`","load_state_dict","`",".","Usage","example","with","medical","segmentation","decathlon","dataset","is","available","at",":","https",":","\/\/github.com\/Project-MONAI\/tutorials\/tree\/master\/modules\/dynunet_pipeline",".","Args",":","spatial_dims",":","number","of","spatial","dimensions",".","in_channels",":","number","of","input","channels",".","out_channels",":","number","of","output","channels",".","kernel_size",":","convolution","kernel","size",".","strides",":","convolution","strides","for","each","blocks",".","upsample_kernel_size",":","convolution","kernel","size","for","transposed","convolution","layers",".","The","values","should","equal","to","strides","[","1",":","]",".","filters",":","number","of","output","channels","for","each","blocks",".","Different","from","nnU-Net",",","in","this","implementation","we","add","this","argument","to","make","the","network","more","flexible",".","As","shown","in","the","third","reference",",","one","way","to","determine","this","argument","is","like",":","``","[","64",",","96",",","128",",","192",",","256",",","384",",","512",",","768",",","1024","]","[",":","len","(","strides",")","]","``",".","The","above","way","is","used","in","the","network","that","wins","task","1","in","the","BraTS21","Challenge",".","If","not","specified",",","the","way","which","nnUNet","used","will","be","employed",".","Defaults","to","``","None","``",".","dropout",":","dropout","ratio",".","Defaults","to","no","dropout",".","norm_name",":","feature","normalization","type","and","arguments",".","Defaults","to","``","INSTANCE","``",".","`","INSTANCE_NVFUSER","`","is","a","faster","version","of","the","instance","norm","layer",",","it","can","be","used","when",":","1",")","`","spatial_dims=3","`",",","2",")","CUDA","device","is","available",",","3",")","`","apex","`","is","installed","and","4",")","non-Windows","OS","is","used",".","act_name",":","activation","layer","type","and","arguments",".","Defaults","to","``","leakyrelu","``",".","deep_supervision",":","whether","to","add","deep","supervision","head","before","output",".","Defaults","to","``","False","``",".","If","``","True","``",",","in","training","mode",",","the","forward","function","will","output","not","only","the","final","feature","map","(","from","`","output_block","`",")",",","but","also","the","feature","maps","that","come","from","the","intermediate","up","sample","layers",".","In","order","to","unify","the","return","type","(","the","restriction","of","TorchScript",")",",","all","intermediate","feature","maps","are","interpolated","into","the","same","size","as","the","final","feature","map","and","stacked","together","(","with","a","new","dimension","in","the","first","axis",")","into","one","single","tensor",".","For","instance",",","if","there","are","two","intermediate","feature","maps","with","shapes",":","(","1",",","2",",","16",",","12",")","and","(","1",",","2",",","8",",","6",")",",","and","the","final","feature","map","has","the","shape","(","1",",","2",",","32",",","24",")",",","then","all","intermediate","feature","maps","will","be","interpolated","into","(","1",",","2",",","32",",","24",")",",","and","the","stacked","tensor","will","has","the","shape","(","1",",","3",",","2",",","32",",","24",")",".","When","calculating","the","loss",",","you","can","use","torch.unbind","to","get","all","feature","maps","can","compute","the","loss","one","by","one","with","the","ground","truth",",","then","do","a","weighted","average","for","all","losses","to","achieve","the","final","loss",".","deep_supr_num",":","number","of","feature","maps","that","will","output","during","deep","supervision","head",".","The","value","should","be","larger","than","0","and","less","than","the","number","of","up","sample","layers",".","Defaults","to","1.","res_block",":","whether","to","use","residual","connection","based","convolution","blocks","during","the","network",".","Defaults","to","``","False","``",".","trans_bias",":","whether","to","set","the","bias","parameter","in","transposed","convolution","layers",".","Defaults","to","``","False","``","."]
code: def get_module_list(
      self,
      in_channels: List[int],
      out_channels: List[int],
      kernel_size: Sequence[Union[Sequence[int], int]],
      strides: Sequence[Union[Sequence[int], int]],
      conv_block: nn.Module,
      upsample_kernel_size: Optional[
          Sequence[Union[Sequence[int], int]]
      ] = None,
      trans_bias: bool = False,
  ):
      layers = []
      if upsample_kernel_size is not None:
          for in_c, out_c, kernel, stride, up_kernel in zip(
              in_channels,
              out_channels,
              kernel_size,
              strides,
              upsample_kernel_size,
          ):
              params = {
                  "spatial_dims": self.spatial_dims,
                  "in_channels": in_c,
                  "out_channels": out_c,
                  "kernel_size": kernel,
                  "stride": stride,
                  "norm_name": self.norm_name,
                  "act_name": self.act_name,
                  "dropout": self.dropout,
                  "upsample_kernel_size": up_kernel,
                  "trans_bias": trans_bias,
              }
              layer = conv_block(**params)
              layers.append(layer)
      else:
          for in_c, out_c, kernel, stride in zip(
              in_channels, out_channels, kernel_size, strides
          ):
              params = {
                  "spatial_dims": self.spatial_dims,
                  "in_channels": in_c,
                  "out_channels": out_c,
                  "kernel_size": kernel,
                  "stride": stride,
                  "norm_name": self.norm_name,
                  "act_name": self.act_name,
                  "dropout": self.dropout,
              }
              layer = conv_block(**params)
              layers.append(layer)
      return nn.ModuleList(layers)
  
imports: from typing import List, Optional, Sequence, Tuple, Union
  import torch
  import torch.nn
  from torch.nn.functional import interpolate
  from monai.networks.blocks.dynunet_block import UnetBasicBlock, UnetOutBlock, UnetResBlock, UnetUpBlock
label_desc: Use image node_id 11 for calling the DynUNet obj's underlying member method code with example usage: obj.get_module_list(in_channels, out_channels, kernel_size, strides, conv_block, upsample_kernel_size, trans_bias) and returns: nn