class_docstr: FeCAMClassifier
  
  Similar to NCM but uses malahanobis distance instead of l2 distance
  
  This approach has been proposed for continual learning in
  "FeCAM: Exploiting the Heterogeneity of Class Distributions
  in Exemplar-Free Continual Learning" Goswami et. al.
  (Neurips 2023)
  
  This requires the storage of full per-class covariance matrices
docstr: :param x: (batch_size, feature_size)
  
  Returns a tensor of size (batch_size, num_classes) with
  negative distance of each element in the mini-batch
  with respect to each class.
docstr_tok: [":","param","x",":","(","batch_size",",","feature_size",")","Returns","a","tensor","of","size","(","batch_size",",","num_classes",")","with","negative","distance","of","each","element","in","the","mini-batch","with","respect","to","each","class","."]
code: def forward(self, x):
      """
      :param x: (batch_size, feature_size)
  
      Returns a tensor of size (batch_size, num_classes) with
      negative distance of each element in the mini-batch
      with respect to each class.
      """
      if self.class_means_dict == {}:
          self.init_missing_classes(
              range(self.max_class + 1), x.shape[1], x.device
          )
  
      assert self.class_means_dict != {}, "no class means available."
  
      if self.tukey:
          x = self._tukey_transforms(x)
  
      maha_dist = []
      for class_id, prototype in self.class_means_dict.items():
          cov = self.class_cov_dict[class_id]
          dist = self._mahalanobis(x, prototype, cov)
          maha_dist.append(dist)
  
      # n_classes, batch_size
      maha_dis = torch.stack(maha_dist).T
  
      # (batch_size, num_classes)
      return -maha_dis
  
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 2 for calling the FeCAMClassifier obj's underlying member method code with example usage: obj.forward(x) and returns: unknown