code: def __init__(self, losses, miners=None, weights=None):
      super().__init__()
      self.is_dict = isinstance(losses, dict)
      self.losses = (
          torch.nn.ModuleDict(losses)
          if self.is_dict
          else torch.nn.ModuleList(losses)
      )
  
      if miners is not None:
          self.assertions_if_not_none(miners, match_all_keys=False)
          self.miners = (
              torch.nn.ModuleDict(miners)
              if self.is_dict
              else torch.nn.ModuleList(miners)
          )
      else:
          self.miners = None
  
      if weights is not None:
          self.assertions_if_not_none(weights, match_all_keys=True)
          self.weights = weights
      else:
          self.weights = (
              {k: 1 for k in self.losses.keys()}
              if self.is_dict
              else [1] * len(losses)
          )
  
imports: import torch
  from ..utils import common_functions
label_desc: Use image node_id 1 to create a new MultipleLosses object from inherited base classes: torch.nn with example: obj = MultipleLosses(losses, miners, weights)