class_docstr: This class is for averaging loss across multiple processes if a distributed backend is used. True average is
  computed not running average. It does not accumulate gradients so the averaged loss cannot be used for optimization.
  If ``take_avg_loss`` is ``True``, the :meth:`update` method ``loss`` argument has to be a mean loss. If
  ``take_avg_loss`` is ``False`` then the :meth:`update` method ``loss`` argument has to be a sum of losses.
  
  See :doc:`PyTorch Lightning Metrics<pytorch-lightning:metrics>` for the metric usage instruction.
  
  Args:
      dist_sync_on_step:
          Synchronize metric state across processes at each method :meth:`forward` call before returning the
          value at the step
      process_group:
          Specify the process group on which synchronization is called. default: ``None`` (which selects the entire
          world)
      take_avg_loss:
          If ``True`` values of :meth:`update` method ``loss`` argument has to be a mean loss. If ``False``
          values of :meth:`update` method ``loss`` argument has to be a sum of losses. default: ``True``
docstr: Updates :attr:`loss_sum` and :attr:`num_measurements`.
  
  Args:
      loss: A float zero dimensional ``torch.Tensor`` which is either sum or average of losses for processed
          examples. See ``take_avg_loss`` parameter of :meth:`__init__`.
      num_measurements: An integer zero dimensional ``torch.Tensor`` which contains a number of loss measurements.
          The sum or mean of the results of these measurements are in the ``loss`` parameter.
docstr_tok: ["Updates",":","attr",":","`","loss_sum","`","and",":","attr",":","`","num_measurements","`",".","Args",":","loss",":","A","float","zero","dimensional","``","torch.Tensor","``","which","is","either","sum","or","average","of","losses","for","processed","examples",".","See","``","take_avg_loss","``","parameter","of",":","meth",":","`","__init__","`",".","num_measurements",":","An","integer","zero","dimensional","``","torch.Tensor","``","which","contains","a","number","of","loss","measurements",".","The","sum","or","mean","of","the","results","of","these","measurements","are","in","the","``","loss","``","parameter","."]
code: def update(self, loss, num_measurements):
      """
      Updates :attr:`loss_sum` and :attr:`num_measurements`.
  
      Args:
          loss: A float zero dimensional ``torch.Tensor`` which is either sum or average of losses for processed
              examples. See ``take_avg_loss`` parameter of :meth:`__init__`.
          num_measurements: An integer zero dimensional ``torch.Tensor`` which contains a number of loss measurements.
              The sum or mean of the results of these measurements are in the ``loss`` parameter.
      """
      if self.take_avg_loss:
          self.loss_sum += loss.detach() * num_measurements
      else:
          self.loss_sum += loss.detach()
      self.num_measurements += num_measurements
  
imports: import torch
  from torchmetrics import Metric
label_desc: Use image node_id 2 for calling the GlobalAverageLossMetric obj's underlying member method code with example usage: obj.update(loss, num_measurements) without return types