class_docstr: Confusion Matrix metric compatible with Weights and Biases logger.
  Differently from the `StreamConfusionMatrix`, this metric will use W&B
  built-in functionalities to log the Confusion Matrix.
  
  This metric may not produce meaningful outputs with other loggers.
  
  https://docs.wandb.ai/guides/track/log#custom-charts
class_docstr_tok: ["Confusion","Matrix","metric","compatible","with","Weights","and","Biases","logger",".","Differently","from","the","`","StreamConfusionMatrix","`",",","this","metric","will","use","W","&","B","built-in","functionalities","to","log","the","Confusion","Matrix",".","This","metric","may","not","produce","meaningful","outputs","with","other","loggers",".","https",":","\/\/docs.wandb.ai\/guides\/track\/log","#","custom-charts"]
code: def _package_result(
      self, strategy: "SupervisedTemplate"
  ) -> MetricResult:
      assert strategy.experience is not None
      outputs, targets = self.result()
      phase_name, _ = phase_and_task(strategy)
      stream = stream_type(strategy.experience)
      metric_name = "{}/{}_phase/{}_stream".format(
          str(self), phase_name, stream
      )
      plot_x_position = strategy.clock.train_iterations
  
      # compute predicted classes
      preds = torch.argmax(outputs, dim=1).cpu().numpy()
      result = wandb.plot.confusion_matrix(
          preds=preds,
          y_true=targets.cpu().numpy(),
          class_names=self.class_names,
      )
  
      metric_representation = MetricValue(
          self, metric_name, AlternativeValues(result), plot_x_position
      )
  
      return [metric_representation]
  
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 8 for calling the WandBStreamConfusionMatrix obj's underlying member method code with example usage: obj._package_result(strategy) and returns: list