class_docstr: AR1 with Latent Replay.
  
  This implementations allows for the use of both Synaptic Intelligence and
  Latent Replay to protect the lower level of the model from forgetting.
  
  While the original papers show how to use those two techniques in a mutual
  exclusive way, this implementation allows for the use of both of them
  concurrently. This behaviour is controlled by passing proper constructor
  arguments).
class_docstr_tok: ["AR1","with","Latent","Replay",".","This","implementations","allows","for","the","use","of","both","Synaptic","Intelligence","and","Latent","Replay","to","protect","the","lower","level","of","the","model","from","forgetting",".","While","the","original","papers","show","how","to","use","those","two","techniques","in","a","mutual","exclusive","way",",","this","implementation","allows","for","the","use","of","both","of","them","concurrently",".","This","behaviour","is","controlled","by","passing","proper","constructor","arguments",")","."]
code: def _after_training_exp(self, **kwargs):
      assert self.experience is not None
      h = min(
          self.rm_sz // (self.clock.train_exp_counter + 1),
          self.cur_acts.size(0),
      )
  
      curr_data = self.experience.dataset
      idxs_cur = torch.randperm(self.cur_acts.size(0))[:h]
      rm_add_y = torch.tensor(
          [curr_data.targets[idx_cur] for idx_cur in idxs_cur]
      ).flatten()
  
      rm_add = (self.cur_acts[idxs_cur], rm_add_y)
  
      # replace patterns in random memory
      if self.clock.train_exp_counter == 0:
          self.rm = rm_add
      else:
          idxs_2_replace = torch.randperm(self.rm[0].size(0))[:h]
          for j, idx in enumerate(idxs_2_replace):
              idx = int(idx)
              self.rm[0][idx] = rm_add[0][j]
              self.rm[1][idx] = rm_add[1][j]
  
      # Placeholder Tensor to avoid typing issues
      self.cur_acts = torch.empty(0)
  
      # Runs S.I. and CWR* plugin callbacks
      super()._after_training_exp(**kwargs)
  
imports: import warnings
  from typing import Callable, Optional, List, Tuple, Union
  import torch
  from torch import Tensor
  from torch.nn import CrossEntropyLoss
  from torch.nn.modules.batchnorm import _NormBase
  from torch.optim import SGD
  from torch.utils.data import DataLoader
  from avalanche.models import MobilenetV1
  from avalanche.models.batch_renorm import BatchRenorm2D
  from avalanche.training.plugins import SupervisedPlugin, EvaluationPlugin, SynapticIntelligencePlugin, CWRStarPlugin
  from avalanche.training.templates import SupervisedTemplate
  from avalanche.training.utils import replace_bn_with_brn, get_last_fc_layer, freeze_up_to, change_brn_pars, examples_per_class, LayerAndParameter
  from avalanche.training.plugins.evaluation import default_evaluator
label_desc: Use image node_id 5 for calling the AR1 obj's underlying member method code with example usage: obj._after_training_exp() without return types