class_docstr: Sums a collection of (weighted) torch.nn losses.
  
  NOTE: this applies all the losses to the same output and does not support
  taking a list of outputs as input.
docstr: Instantiates a SumArbitraryLoss from a configuration.
  
  Args:
      config: A configuration for a SumArbitraryLoss.
          See :func:`__init__` for parameters expected in the config.
  
  Returns:
      A SumArbitraryLoss instance.
docstr_tok: ["Instantiates","a","SumArbitraryLoss","from","a","configuration",".","Args",":","config",":","A","configuration","for","a","SumArbitraryLoss",".","See",":","func",":","`","__init__","`","for","parameters","expected","in","the","config",".","Returns",":","A","SumArbitraryLoss","instance","."]
code: def from_config(cls, config: Dict[str, Any]) -> "SumArbitraryLoss":
      """Instantiates a SumArbitraryLoss from a configuration.
  
      Args:
          config: A configuration for a SumArbitraryLoss.
              See :func:`__init__` for parameters expected in the config.
  
      Returns:
          A SumArbitraryLoss instance.
      """
      assert (
          type(config["losses"]) == list and len(config["losses"]) > 0
      ), "losses must be a list of registered losses with length > 0"
      assert type(config["weights"]) == list and len(
          config["weights"]
      ) == len(
          config["losses"]
      ), "weights must be None or a list and have same length as losses"
  
      loss_modules = []
      for loss_config in config["losses"]:
          loss_modules.append(build_loss(loss_config))
  
      assert all(
          isinstance(loss_module, ClassyLoss)
          for loss_module in loss_modules
      ), "All losses must be registered, valid ClassyLosses"
  
      return cls(
          losses=loss_modules, weights=config.get("weights", None)
      )
  
file_path: ClassyVision/classy_vision/losses/sum_arbitrary_loss.py
imports: from typing import Any, Dict, List, Optional
  import torch
  from torch import Tensor
  from .None import build_loss, ClassyLoss, register_loss
label_desc: Use image node_id 2 for calling the SumArbitraryLoss obj's underlying member method code with example usage: obj.from_config(cls, config) and returns: cls