class_docstr: Masked Cross Entropy
  
  This criterion can be used for instance in Class Incremental
  Learning Problems when no examplars are used
  (i.e LwF in Class Incremental Learning would need to use mask="new").
docstr: param: classes: Initial value for current classes
  param: mask: "all" normal cross entropy, uses all the classes seen so far
               "old" cross entropy only on the old classes
               "new" cross entropy only on the new classes
  param: reduction: "mean" or "none", average or per-sample loss
docstr_tok: ["param",":","classes",":","Initial","value","for","current","classes","param",":","mask",":","``","all","''","normal","cross","entropy",",","uses","all","the","classes","seen","so","far","``","old","''","cross","entropy","only","on","the","old","classes","``","new","''","cross","entropy","only","on","the","new","classes","param",":","reduction",":","``","mean","''","or","``","none","''",",","average","or","per-sample","loss"]
code: def __init__(self, classes=None, mask="seen", reduction="mean"):
      """
      param: classes: Initial value for current classes
      param: mask: "all" normal cross entropy, uses all the classes seen so far
                   "old" cross entropy only on the old classes
                   "new" cross entropy only on the new classes
      param: reduction: "mean" or "none", average or per-sample loss
      """
      super().__init__()
      assert mask in ["seen", "new", "old", "all"]
      if classes is not None:
          self.current_classes = set(classes)
      else:
          self.current_classes = set()
  
      self.old_classes = set()
      self.reduction = reduction
      self.mask = mask
  
imports: import copy
  import numpy
  import torch
  import torch.nn.functional
  from torch import nn
  from torch.nn import BCELoss
  from avalanche.training.plugins import SupervisedPlugin
  from avalanche.training.regularization import cross_entropy_with_oh_targets
label_desc: Use image node_id 1 to create a new MaskedCrossEntropy object from inherited base classes: SupervisedPlugin with example: obj = MaskedCrossEntropy(classes, mask, reduction)