class_docstr: Loss Metric.
  
  Instances of this metric keep the running average loss
  over multiple <prediction, target> pairs of Tensors,
  provided incrementally.
  
  Each time `result` is called, this metric emits the average loss
  across all predictions made since the last `reset`.
  
  The reset method will bring the metric to its initial state. By default
  this metric in its initial state will return a loss value of 0.
class_docstr_tok: ["Loss","Metric",".","Instances","of","this","metric","keep","the","running","average","loss","over","multiple","<","prediction",",","target",">","pairs","of","Tensors",",","provided","incrementally",".","Each","time","`","result","`","is","called",",","this","metric","emits","the","average","loss","across","all","predictions","made","since","the","last","`","reset","`",".","The","reset","method","will","bring","the","metric","to","its","initial","state",".","By","default","this","metric","in","its","initial","state","will","return","a","loss","value","of","0","."]
docstr: Update the running loss.
  
  :param loss: The loss Tensor. Different reduction types don't affect
      the result.
  :param patterns: The number of patterns in the minibatch.
  :return: None.
code: def update(self, loss: Tensor, patterns: int) -> None:
      """Update the running loss.
  
      :param loss: The loss Tensor. Different reduction types don't affect
          the result.
      :param patterns: The number of patterns in the minibatch.
      :return: None.
      """
      self._mean_loss.update(torch.mean(loss), weight=patterns)
  
imports: from typing import List, Dict
  import torch
  from torch import Tensor
  from avalanche.evaluation import PluginMetric, Metric, GenericPluginMetric
  from avalanche.evaluation.metrics.mean import Mean
  from avalanche.evaluation.metric_utils import phase_and_task
  from collections import defaultdict
label_desc: Use image node_id 2 for calling the LossMetric obj's underlying member method code with example usage: obj.update(loss, patterns) without return types