class_docstr: Asymmetric metric learning (AML) Criterion used in
  "New Insights on Reducing Abrupt Representation
  Change in Online Continual Learning"
  by Lucas Caccia et. al.
  https://openreview.net/forum?id=N8MaByOzUfb
docstr: ER_AML criterion constructor.
  :param feature_extractor: Model able to map an input in a latent space.
  :param temp: Supervised contrastive temperature.
  :param base_temp: Supervised contrastive base temperature.
  :param same_task_neg: Option to remove negative samples of different tasks.
  :param device: Accelerator used to speed up the computation.
docstr_tok: ["ER_AML","criterion","constructor",".",":","param","feature_extractor",":","Model","able","to","map","an","input","in","a","latent","space",".",":","param","temp",":","Supervised","contrastive","temperature",".",":","param","base_temp",":","Supervised","contrastive","base","temperature",".",":","param","same_task_neg",":","Option","to","remove","negative","samples","of","different","tasks",".",":","param","device",":","Accelerator","used","to","speed","up","the","computation","."]
code: def __init__(
      self,
      feature_extractor,
      temp: float = 0.1,
      base_temp: float = 0.07,
      same_task_neg: bool = True,
      device: str = "cpu",
  ):
      """
      ER_AML criterion constructor.
      :param feature_extractor: Model able to map an input in a latent space.
      :param temp: Supervised contrastive temperature.
      :param base_temp: Supervised contrastive base temperature.
      :param same_task_neg: Option to remove negative samples of different tasks.
      :param device: Accelerator used to speed up the computation.
      """
      self.device = device
      self.feature_extractor = feature_extractor
      self.temp = temp
      self.base_temp = base_temp
      self.same_task_neg = same_task_neg
  
imports: import copy
  from collections import defaultdict
  from typing import List
  import torch
  import torch.nn.functional
  from avalanche.models import MultiTaskModule, avalanche_forward
label_desc: Use image node_id 1 to create a new AMLCriterion object from inherited base classes: RegularizationMethod with example: obj = AMLCriterion(feature_extractor, temp, base_temp, same_task_neg, device)