code: def _exp_structure_from_assignment(
      dataset: ISupportedClassificationDataset[Any],
      assignment: Sequence[Sequence[int]],
      n_classes: int,
  ):
      n_experiences = len(assignment)
      exp_structure = [
          [0 for _ in range(n_classes)] for _ in range(n_experiences)
      ]
  
      for exp_id in range(n_experiences):
          exp_targets = [
              int(dataset.targets[pattern_idx])
              for pattern_idx in assignment[exp_id]
          ]
          cls_ids, cls_counts = torch.unique(
              torch.as_tensor(exp_targets), return_counts=True
          )
  
          for unique_idx in range(len(cls_ids)):
              exp_structure[exp_id][int(cls_ids[unique_idx])] += int(
                  cls_counts[unique_idx]
              )
  
      return exp_structure
  
imports: from typing import Sequence, Any
  import torch
  from avalanche.benchmarks.utils.dataset_definitions import ISupportedClassificationDataset
label_desc: Use image node_id 1 for calling a global function with example usage: _exp_structure_from_assignment(dataset, assignment, n_classes) and returns: exp_structure