class_docstr: Encoder Decoder segmentors.
  
  EncoderDecoder typically consists of backbone, decode_head, auxiliary_head.
  Note that auxiliary_head is only used for deep supervision during training,
  which could be dumped during inference.
class_docstr_tok: ["Encoder","Decoder","segmentors",".","EncoderDecoder","typically","consists","of","backbone",",","decode_head",",","auxiliary_head",".","Note","that","auxiliary_head","is","only","used","for","deep","supervision","during","training",",","which","could","be","dumped","during","inference","."]
docstr: Run forward function and calculate loss for auxiliary head in
  training.
docstr_tok: ["Run","forward","function","and","calculate","loss","for","auxiliary","head","in","training","."]
code: def _auxiliary_head_forward_train(
      self, x, img_metas, gt_semantic_seg
  ):
      """Run forward function and calculate loss for auxiliary head in
      training."""
      losses = dict()
      if isinstance(self.auxiliary_head, nn.ModuleList):
          for idx, aux_head in enumerate(self.auxiliary_head):
              loss_aux = aux_head.forward_train(
                  x, img_metas, gt_semantic_seg, self.train_cfg
              )
              losses.update(add_prefix(loss_aux, f"aux_{idx}"))
      else:
          loss_aux = self.auxiliary_head.forward_train(
              x, img_metas, gt_semantic_seg, self.train_cfg
          )
          losses.update(add_prefix(loss_aux, "aux"))
  
      return losses
  
imports: import torch
  import torch.nn
  import torch.nn.functional
  from mmseg.core import add_prefix
  from mmseg.models import builder
  from mmseg.models.builder import SEGMENTORS
  from mmseg.models.segmentors.base import BaseSegmentor
  from mmseg.ops import resize
label_desc: Use image node_id 8 for calling the EncoderDecoderMask2Former obj's underlying member method code with example usage: obj._auxiliary_head_forward_train(x, img_metas, gt_semantic_seg) and returns: losses