class_docstr: Wrapper class around the main loss function to accept a list of tensors returned from a deeply
  supervised networks. The final loss is computed as the sum of weighted losses for each of deep supervision levels.
docstr: Args:
      loss: main loss instance, e.g DiceLoss().
      weight_mode: {``"same"``, ``"exp"``, ``"two"``}
          Specifies the weights calculation for each image level. Defaults to ``"exp"``.
          - ``"same"``: all weights are equal to 1.
          - ``"exp"``: exponentially decreasing weights by a power of 2: 0, 0.5, 0.25, 0.125, etc .
          - ``"two"``: equal smaller weights for lower levels: 1, 0.5, 0.5, 0.5, 0.5, etc
      weights: a list of weights to apply to each deeply supervised sub-loss, if provided, this will be used
          regardless of the weight_mode
code: def __init__(
      self,
      loss: _Loss,
      weight_mode: str = "exp",
      weights: list[float] | None = None,
  ) -> None:
      """
      Args:
          loss: main loss instance, e.g DiceLoss().
          weight_mode: {``"same"``, ``"exp"``, ``"two"``}
              Specifies the weights calculation for each image level. Defaults to ``"exp"``.
              - ``"same"``: all weights are equal to 1.
              - ``"exp"``: exponentially decreasing weights by a power of 2: 0, 0.5, 0.25, 0.125, etc .
              - ``"two"``: equal smaller weights for lower levels: 1, 0.5, 0.5, 0.5, 0.5, etc
          weights: a list of weights to apply to each deeply supervised sub-loss, if provided, this will be used
              regardless of the weight_mode
      """
      super().__init__()
      self.loss = loss
      self.weight_mode = weight_mode
      self.weights = weights
      self.interp_mode = (
          "nearest-exact" if pytorch_after(1, 11) else "nearest"
      )
  
file_path: MONAI/monai/losses/ds_loss.py
imports: from __future__ import annotations
  from typing import Union
  import torch
  import torch.nn.functional
  from torch.nn.modules.loss import _Loss
  from monai.utils import pytorch_after
label_desc: Use image node_id 1 to create a new DeepSupervisionLoss object from inherited base classes: _Loss with example: obj = DeepSupervisionLoss(loss, weight_mode, weights)