docstr: This should be called in the forward pass to add a custom loss term to the combined loss.
docstr_tok: ["This","should","be","called","in","the","forward","pass","to","add","a","custom","loss","term","to","the","combined","loss","."]
code: def update_loss(self, key: str, loss: torch.Tensor):
      """This should be called in the forward pass to add a custom loss term to the combined loss."""
      self._losses[key] = loss
  
imports: import math
  import os
  import warnings
  from abc import abstractmethod
  from functools import lru_cache
  from typing import List, Optional, Tuple, Union
  import torch
  from torch import nn
  from torch.nn import Module, ModuleDict
  from ludwig.api_annotations import DeveloperAPI
  from ludwig.constants import ENCODER_OUTPUT
  from ludwig.utils.strings_utils import SpecialSymbol
label_desc: Use image node_id 5 for calling the LudwigModule obj's underlying member method code with example usage: obj.update_loss(key, loss) without return types