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: Creates an instance of the evaluation plugin.
  
  :param metrics: The metrics to compute.
  :param loggers: The loggers to be used to log the metric values.
  :param collect_all: if True, collect in a separate dictionary all
      metric curves values. This dictionary is accessible with
      `get_all_metrics` method.
  :param strict_checks: if True, checks that the full evaluation streams
      is used when calling `eval`. An error will be raised otherwise.
docstr_tok: ["Creates","an","instance","of","the","evaluation","plugin",".",":","param","metrics",":","The","metrics","to","compute",".",":","param","loggers",":","The","loggers","to","be","used","to","log","the","metric","values",".",":","param","collect_all",":","if","True",",","collect","in","a","separate","dictionary","all","metric","curves","values",".","This","dictionary","is","accessible","with","`","get_all_metrics","`","method",".",":","param","strict_checks",":","if","True",",","checks","that","the","full","evaluation","streams","is","used","when","calling","`","eval","`",".","An","error","will","be","raised","otherwise","."]
code: def __init__(
      self,
      *metrics: Union["PluginMetric", Sequence["PluginMetric"]],
      loggers: Optional[
          Union[
              "BaseLogger",
              Sequence["BaseLogger"],
              Callable[[], Sequence["BaseLogger"]],
          ]
      ] = None,
      collect_all=True,
      strict_checks=False,
  ):
      """Creates an instance of the evaluation plugin.
  
      :param metrics: The metrics to compute.
      :param loggers: The loggers to be used to log the metric values.
      :param collect_all: if True, collect in a separate dictionary all
          metric curves values. This dictionary is accessible with
          `get_all_metrics` method.
      :param strict_checks: if True, checks that the full evaluation streams
          is used when calling `eval`. An error will be raised otherwise.
      """
      super().__init__()
      self.supports_distributed = True
      self.collect_all = collect_all
      self.strict_checks = strict_checks
  
      flat_metrics_list = []
      for metric in metrics:
          if isinstance(metric, Sequence):
              flat_metrics_list += list(metric)
          else:
              flat_metrics_list.append(metric)
      self.metrics = flat_metrics_list
  
      if loggers is None:
          loggers = []
      elif callable(loggers):
          loggers = loggers()
      elif not isinstance(loggers, Sequence):
          loggers = [loggers]
  
      self.loggers: Sequence["BaseLogger"] = loggers
  
      if len(self.loggers) == 0 and DistributedHelper.is_main_process:
          warnings.warn(
              "No loggers specified, metrics will not be logged"
          )
  
      self.all_metric_results: Dict[str, Tuple[List[int], List[Any]]]
      if self.collect_all:
          # for each curve collect all emitted values.
          # dictionary key is full metric name.
          # Dictionary value is a tuple of two lists.
          # first list gathers x values (indices representing
          # time steps at which the corresponding metric value
          # has been emitted)
          # second list gathers metric values
          # SERIALIZATION NOTICE: don't use a lambda here, otherwise
          # serialization may fail in some cases.
          self.all_metric_results = defaultdict(
              _init_metrics_list_lambda
          )
      else:
          self.all_metric_results = dict()
  
      # Dictionary of last values emitted. Dictionary key
      # is the full metric name, while dictionary value is
      # metric value.
      self.last_metric_results: Dict[str, Any] = {}
  
      self._active = True
      """If False, no metrics will be collected."""
  
      self._metric_values: List[MetricValue] = []
      """List of metrics that have yet to be processed by loggers."""
  
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 1 to create a new EvaluationPlugin object  with example: obj = EvaluationPlugin()