class_docstr: Generic Loss interface.
  A loss has a name, a configuration, and stores information about the output and label it requires from the model(s),
  as well as a weight (default 1.0) and a method to create the corresponding metric.
class_docstr_tok: ["Generic","Loss","interface",".","A","loss","has","a","name",",","a","configuration",",","and","stores","information","about","the","output","and","label","it","requires","from","the","model","(","s",")",",","as","well","as","a","weight","(","default","1.0",")","and","a","method","to","create","the","corresponding","metric","."]
code: def metric(self) -> "LossMetric":
      if self._metric is None:
          self._metric = self.create_metric()
      return self._metric
  
imports: import logging
  import math
  from abc import ABC, abstractmethod
  from typing import Any, Dict, Optional, Tuple
  import torch
  import numpy
  from .None import constants
  from .None import utils
label_desc: Use image node_id 4 for calling the Loss obj's underlying member method code with example usage: obj.metric() and returns: self