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: Calculates weights for a given number of scale levels
code: def get_weights(self, levels: int = 1) -> list[float]:
      """
      Calculates weights for a given number of scale levels
      """
      levels = max(1, levels)
      if self.weights is not None and len(self.weights) >= levels:
          weights = self.weights[:levels]
      elif self.weight_mode == "same":
          weights = [1.0] * levels
      elif self.weight_mode == "exp":
          weights = [max(0.5**l, 0.0625) for l in range(levels)]
      elif self.weight_mode == "two":
          weights = [1.0 if l == 0 else 0.5 for l in range(levels)]
      else:
          weights = [1.0] * levels
  
      return weights
  
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 2 for calling the DeepSupervisionLoss obj's underlying member method code with example usage: obj.get_weights(levels) and returns: weights