class_docstr: Equivalent to IncrementalClassifier but using the cosine layer
  described in "Learning a Unified Classifier Incrementally via Rebalancing"
  by Saihui Hou et al.
class_docstr_tok: ["Equivalent","to","IncrementalClassifier","but","using","the","cosine","layer","described","in","``","Learning","a","Unified","Classifier","Incrementally","via","Rebalancing","''","by","Saihui","Hou","et","al","."]
docstr: :param in_features: Number of input features
  :param num_classes: Number of initial classes (default=0)
                      If set to more than 0, the initial logits
                      will be mapped to the corresponding sequence of
                      classes starting from 0.
docstr_tok: [":","param","in_features",":","Number","of","input","features",":","param","num_classes",":","Number","of","initial","classes","(","default=0",")","If","set","to","more","than","0",",","the","initial","logits","will","be","mapped","to","the","corresponding","sequence","of","classes","starting","from","0","."]
code: def __init__(self, in_features, num_classes=0):
      """
      :param in_features: Number of input features
      :param num_classes: Number of initial classes (default=0)
                          If set to more than 0, the initial logits
                          will be mapped to the corresponding sequence of
                          classes starting from 0.
      """
      super().__init__()
      self.class_order = []
      self.classes = set()
  
      if num_classes == 0:
          self.fc = None
      else:
          self.fc = CosineLinear(in_features, num_classes, sigma=True)
          for i in range(num_classes):
              self.class_order.append(i)
          self.classes = set(range(5))
  
      self.feature_dim = in_features
  
imports: import math
  import torch
  import torch.nn
  import torch.nn.functional
  import numpy
  from avalanche.models import DynamicModule
label_desc: Use image node_id 1 to create a new CosineIncrementalClassifier object from inherited base classes: DynamicModule with example: obj = CosineIncrementalClassifier(in_features, num_classes)