class_docstr: Control the loops for training, evaluation, and prediction. This module is independent of
  the model definition. This class inherits from the Pytorch Lightning's LightningModule:
  https://lightning.ai/docs/pytorch/stable/common/lightning_module.html
code: def _compute_loss(
      self,
      output: Dict,
      label: torch.Tensor,
  ):
      loss = 0
      for _, per_output in output.items():
          weight = per_output[WEIGHT] if WEIGHT in per_output else 1
          if (
              TEMPLATE_LOGITS in per_output
              and self.model.prefix == T_FEW
          ):  # Do only add template loss if T-Few. #TODO Add compatibility to Fusion models.
              loss += (
                  self._compute_template_loss(per_output, label)
                  * weight
              )
          else:
              loss += (
                  self.loss_func(
                      input=per_output[LOGITS].squeeze(dim=1),
                      target=label,
                  )
                  * weight
              )
      return loss
  
imports: import logging
  from typing import Callable, Dict, List, Optional, Union
  import lightning.pytorch
  import torch
  import torch.nn.functional
  import torchmetrics
  from lightning.pytorch.strategies import DeepSpeedStrategy
  from lightning.pytorch.utilities import grad_norm
  from torch import nn
  from torch.nn.modules.loss import _Loss
  from torchmetrics.aggregation import BaseAggregator
  from ..constants import LM_TARGET, LOGITS, T_FEW, TEMPLATE_LOGITS, WEIGHT
  from ..data.mixup import MixupModule, multimodel_mixup
  from ..models.utils import run_model
  from .semantic_seg_metrics import COD, Balanced_Error_Rate
  from .utils import apply_layerwise_lr_decay, apply_single_lr, apply_two_stages_lr, get_lr_scheduler, get_optimizer
label_desc: Use image node_id 3 for calling the LitModule obj's underlying member method code with example usage: obj._compute_loss(output, label) and returns: loss