class_docstr: Manager for logging and metrics.
  
  An evaluation plugin that obtains relevant data from the
  training and eval loops of the strategy through callbacks.
  The plugin keeps a dictionary with the last recorded value for each metric.
  The dictionary will be returned by the `train` and `eval` methods of the
  strategies.
  It is also possible to keep a dictionary with all recorded metrics by
  specifying `collect_all=True`. The dictionary can be retrieved via
  the `get_all_metrics` method.
  
  This plugin also logs metrics using the provided loggers.
class_docstr_tok: ["Manager","for","logging","and","metrics",".","An","evaluation","plugin","that","obtains","relevant","data","from","the","training","and","eval","loops","of","the","strategy","through","callbacks",".","The","plugin","keeps","a","dictionary","with","the","last","recorded","value","for","each","metric",".","The","dictionary","will","be","returned","by","the","`","train","`","and","`","eval","`","methods","of","the","strategies",".","It","is","also","possible","to","keep","a","dictionary","with","all","recorded","metrics","by","specifying","`","collect_all=True","`",".","The","dictionary","can","be","retrieved","via","the","`","get_all_metrics","`","method",".","This","plugin","also","logs","metrics","using","the","provided","loggers","."]
docstr: Call the metric plugins with the correct callback `callback` and
  update the loggers with the new metric values.
docstr_tok: ["Call","the","metric","plugins","with","the","correct","callback","`","callback","`","and","update","the","loggers","with","the","new","metric","values","."]
code: def _update_metrics_and_loggers(
      self, strategy: "SupervisedTemplate", callback: str
  ):
      """Call the metric plugins with the correct callback `callback` and
      update the loggers with the new metric values."""
      original_experience = strategy.experience
      if original_experience is not None:
          # Set experience to LOGGING so that certain fields can be accessed
          strategy.experience = original_experience.logging()
      try:
          if not self._active:
              return []
  
          for metric in self.metrics:
              if hasattr(metric, callback):
                  metric_result = getattr(metric, callback)(strategy)
                  if isinstance(metric_result, Sequence):
                      for mval in metric_result:
                          self.publish_metric_value(mval)
                  elif metric_result is not None:
                      self.publish_metric_value(metric_result)
  
          for logger in self.loggers:
              logger.log_metrics(self._metric_values)
              if hasattr(logger, callback):
                  getattr(logger, callback)(
                      strategy, self._metric_values
                  )
          self._metric_values = []
      finally:
          # Revert to previous experience (mode = EVAL or TRAIN)
          strategy.experience = original_experience
  
imports: import warnings
  from copy import copy
  from collections import defaultdict
  from typing import Any, Callable, Dict, List, Optional, Tuple, Union, Sequence, TYPE_CHECKING
  from avalanche.distributed.distributed_helper import DistributedHelper
  from avalanche.evaluation.metric_results import MetricValue
  from avalanche.evaluation.metrics import accuracy_metrics, loss_metrics
  from avalanche.logging import InteractiveLogger
label_desc: Use image node_id 5 for calling the EvaluationPlugin obj's underlying member method code with example usage: obj._update_metrics_and_loggers(strategy, callback) and returns: list