class_docstr: The standalone confusion matrix metric.
  
  Instances of this metric keep track of the confusion matrix by receiving a
  pair of "ground truth" and "prediction" Tensors describing the labels of a
  minibatch. Those two tensors can both contain plain labels or
  one-hot/logit vectors.
  
  The result is the unnormalized running confusion matrix.
  
  Beware that by default the confusion matrix size will depend on the value of
  the maximum label as detected by looking at both the ground truth and
  predictions Tensors. When passing one-hot/logit vectors, this
  metric will try to infer the number of classes from the vector sizes.
  Otherwise, the maximum label value encountered in the truth/prediction
  Tensors will be used.
  
  If the user sets the `num_classes`, then the confusion matrix will always be
  of size `num_classes, num_classes`. Whenever a prediction or label tensor is
  provided as logits, only the first `num_classes` units will be considered in
  the confusion matrix computation. If they are provided as numerical labels,
  each of them has to be smaller than `num_classes`.
  
  The reset method will bring the metric to its initial state. By default
  this metric in its initial state will return an empty Tensor.
class_docstr_tok: ["The","standalone","confusion","matrix","metric",".","Instances","of","this","metric","keep","track","of","the","confusion","matrix","by","receiving","a","pair","of","``","ground","truth","''","and","``","prediction","''","Tensors","describing","the","labels","of","a","minibatch",".","Those","two","tensors","can","both","contain","plain","labels","or","one-hot\/logit","vectors",".","The","result","is","the","unnormalized","running","confusion","matrix",".","Beware","that","by","default","the","confusion","matrix","size","will","depend","on","the","value","of","the","maximum","label","as","detected","by","looking","at","both","the","ground","truth","and","predictions","Tensors",".","When","passing","one-hot\/logit","vectors",",","this","metric","will","try","to","infer","the","number","of","classes","from","the","vector","sizes",".","Otherwise",",","the","maximum","label","value","encountered","in","the","truth\/prediction","Tensors","will","be","used",".","If","the","user","sets","the","`","num_classes","`",",","then","the","confusion","matrix","will","always","be","of","size","`","num_classes",",","num_classes","`",".","Whenever","a","prediction","or","label","tensor","is","provided","as","logits",",","only","the","first","`","num_classes","`","units","will","be","considered","in","the","confusion","matrix","computation",".","If","they","are","provided","as","numerical","labels",",","each","of","them","has","to","be","smaller","than","`","num_classes","`",".","The","reset","method","will","bring","the","metric","to","its","initial","state",".","By","default","this","metric","in","its","initial","state","will","return","an","empty","Tensor","."]
docstr: Creates an instance of the standalone confusion matrix metric.
  
  By default this metric in its initial state will return an empty Tensor.
  The metric can be updated by using the `update` method while the running
  confusion matrix can be retrieved using the `result` method.
  
  :param num_classes: The number of classes. Defaults to None,
      which means that the number of classes will be inferred from
      ground truth and prediction Tensors (see class description for more
      details). If not None, the confusion matrix will always be of size
      `num_classes, num_classes` and only the first `num_classes` values
      of output logits or target logits will be considered in the update.
      If the output or targets are provided as numerical labels,
      there can be no label greater than `num_classes`.
  :param normalize: how to normalize confusion matrix.
      None to not normalize
docstr_tok: ["Creates","an","instance","of","the","standalone","confusion","matrix","metric",".","By","default","this","metric","in","its","initial","state","will","return","an","empty","Tensor",".","The","metric","can","be","updated","by","using","the","`","update","`","method","while","the","running","confusion","matrix","can","be","retrieved","using","the","`","result","`","method",".",":","param","num_classes",":","The","number","of","classes",".","Defaults","to","None",",","which","means","that","the","number","of","classes","will","be","inferred","from","ground","truth","and","prediction","Tensors","(","see","class","description","for","more","details",")",".","If","not","None",",","the","confusion","matrix","will","always","be","of","size","`","num_classes",",","num_classes","`","and","only","the","first","`","num_classes","`","values","of","output","logits","or","target","logits","will","be","considered","in","the","update",".","If","the","output","or","targets","are","provided","as","numerical","labels",",","there","can","be","no","label","greater","than","`","num_classes","`",".",":","param","normalize",":","how","to","normalize","confusion","matrix",".","None","to","not","normalize"]
code: def __init__(
      self,
      num_classes: Optional[int] = None,
      normalize: Optional[Literal["true", "pred", "all"]] = None,
  ):
      """Creates an instance of the standalone confusion matrix metric.
  
      By default this metric in its initial state will return an empty Tensor.
      The metric can be updated by using the `update` method while the running
      confusion matrix can be retrieved using the `result` method.
  
      :param num_classes: The number of classes. Defaults to None,
          which means that the number of classes will be inferred from
          ground truth and prediction Tensors (see class description for more
          details). If not None, the confusion matrix will always be of size
          `num_classes, num_classes` and only the first `num_classes` values
          of output logits or target logits will be considered in the update.
          If the output or targets are provided as numerical labels,
          there can be no label greater than `num_classes`.
      :param normalize: how to normalize confusion matrix.
          None to not normalize
      """
      self._cm_tensor: Optional[Tensor] = None
      """
          The Tensor where the running confusion matrix is stored.
          """
      self._num_classes: Optional[int] = num_classes
  
      self.normalize = normalize
  
imports: from matplotlib.figure import Figure
  from numpy import arange
  from typing_extensions import Literal
  from typing import Any, Callable, Iterable, Union, Optional, TYPE_CHECKING, List
  import wandb
  import numpy
  import torch
  from PIL.Image import Image
  from torch import Tensor
  from torch.nn.functional import pad
  from avalanche.benchmarks import NCScenario
  from avalanche.evaluation import PluginMetric, Metric
  from avalanche.evaluation.metric_results import AlternativeValues, MetricValue, MetricResult
  from avalanche.evaluation.metric_utils import default_cm_image_creator, phase_and_task, stream_type
label_desc: Use image node_id 1 to create a new ConfusionMatrix object from inherited base classes: Metric with example: obj = ConfusionMatrix(num_classes, normalize)