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 decode head in
  training.
docstr_tok: ["Run","forward","function","and","calculate","loss","for","decode","head","in","training","."]
code: def _decode_head_forward_train(
      self, x, img_metas, gt_semantic_seg, **kwargs
  ):
      """Run forward function and calculate loss for decode head in
      training."""
      losses = dict()
      loss_decode = self.decode_head.forward_train(
          x, img_metas, gt_semantic_seg, **kwargs
      )
  
      losses.update(add_prefix(loss_decode, "decode"))
      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 6 for calling the EncoderDecoderMask2Former obj's underlying member method code with example usage: obj._decode_head_forward_train(x, img_metas, gt_semantic_seg) and returns: losses