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``
code: def __init__(
      self,
      dist_sync_on_step=False,
      process_group=None,
      take_avg_loss=True,
  ):
      super().__init__(
          dist_sync_on_step=dist_sync_on_step,
          process_group=process_group,
      )
      self.add_state(
          "loss_sum",
          torch.tensor(0.0, dtype=torch.float64),
          dist_reduce_fx="sum",
      )
      self.add_state(
          "num_measurements",
          torch.tensor(0, dtype=torch.int64),
          dist_reduce_fx="sum",
      )
      self.take_avg_loss = take_avg_loss
  
imports: import torch
  from torchmetrics import Metric
label_desc: Use image node_id 1 to create a new GlobalAverageLossMetric object from inherited base classes: Metric with example: obj = GlobalAverageLossMetric(dist_sync_on_step, process_group, take_avg_loss)