code: def compute_covariance(features, labels) -> Dict:
      class_cov = {}
      for class_id in list(torch.unique(labels).cpu().int().numpy()):
          mask = labels == class_id
          class_features = features[mask]
          cov = torch.cov(class_features.T)
          class_cov[class_id] = cov
      return class_cov
  
imports: import copy
  from typing import Dict
  import numpy
  import torch
  import torch.nn.functional
  import tqdm
  from torch import Tensor, nn
  from avalanche.models import DynamicModule
label_desc: Use image node_id 1 for calling a global function with example usage: compute_covariance(features, labels) and returns: class_cov