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: Method able to compute the ER_AML loss.
  :param input_in: New inputs examples.
  :param target_in: Labels of new examples.
  :param task_in: Task identifiers of new examples.
  :param output_buffer: Predictions of samples from buffer.
  :param target_buffer: Labels of samples from buffer.
  :param pos_neg_replay: Replay data to compute positive and negative samples.
  :return: ER_AML computed loss.
docstr_tok: ["Method","able","to","compute","the","ER_AML","loss",".",":","param","input_in",":","New","inputs","examples",".",":","param","target_in",":","Labels","of","new","examples",".",":","param","task_in",":","Task","identifiers","of","new","examples",".",":","param","output_buffer",":","Predictions","of","samples","from","buffer",".",":","param","target_buffer",":","Labels","of","samples","from","buffer",".",":","param","pos_neg_replay",":","Replay","data","to","compute","positive","and","negative","samples",".",":","return",":","ER_AML","computed","loss","."]
code: def __call__(
      self,
      input_in: torch.Tensor,
      target_in: torch.Tensor,
      task_in: torch.Tensor,
      output_buffer: torch.Tensor,
      target_buffer: torch.Tensor,
      pos_neg_replay: tuple,
  ) -> torch.Tensor:
      """
      Method able to compute the ER_AML loss.
      :param input_in: New inputs examples.
      :param target_in: Labels of new examples.
      :param task_in: Task identifiers of new examples.
      :param output_buffer: Predictions of samples from buffer.
      :param target_buffer: Labels of samples from buffer.
      :param pos_neg_replay: Replay data to compute positive and negative samples.
      :return: ER_AML computed loss.
      """
      pos_x, pos_y, neg_x, neg_y = self.__sample_pos_neg(
          target_in, task_in, *pos_neg_replay
      )
      loss_buffer = F.cross_entropy(output_buffer, target_buffer)
      hidden_in = self.__scale_by_norm(self.feature_extractor(input_in))
      hidden_pos_neg = self.__scale_by_norm(
          self.feature_extractor(torch.cat((pos_x, neg_x)))
      )
      loss_in = self.__sup_con_loss(
          anchor_features=hidden_in.repeat(2, 1),
          features=hidden_pos_neg,
          anchor_targets=target_in.repeat(2),
          targets=torch.cat((pos_y, neg_y)),
      )
      return loss_in + loss_buffer
  
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 5 for calling the AMLCriterion obj's underlying member method code with example usage: obj.__call__(input_in, target_in, task_in, output_buffer, target_buffer, pos_neg_replay) and returns: unknown