class_docstr: Bias Correction (BiC) plugin.
  
  Technique introduced in:
  "Wu, Yue, et al. "Large scale incremental learning." Proceedings
  of the IEEE/CVF Conference on Computer Vision and Pattern
  Recognition. 2019"
  
  Implementation based on FACIL, as in:
  https://github.com/mmasana/FACIL/blob/master/src/approach/bic.py
docstr: Dataloader to build batches containing examples from both memories and
  the training dataset
docstr_tok: ["Dataloader","to","build","batches","containing","examples","from","both","memories","and","the","training","dataset"]
code: def before_training_exp(
      self,
      strategy: "SupervisedTemplate",
      num_workers: int = 0,
      shuffle: bool = True,
      **kwargs,
  ):
      """
      Dataloader to build batches containing examples from both memories and
      the training dataset
      """
      assert strategy.adapted_dataset is not None
      task_id = strategy.clock.train_exp_counter
  
      if task_id not in self.bias_layer:
          targets = getattr(strategy.adapted_dataset, "targets")
          self.bias_layer[task_id] = BiasLayer(
              strategy.device, list(targets.uniques)
          )
  
      if len(self.storage_policy.buffer) == 0:
          # first experience. We don't use the buffer, no need to change
          # the dataloader.
          return
  
      batch_size = self.batch_size
      if batch_size is None:
          batch_size = strategy.train_mb_size
  
      batch_size_mem = self.batch_size_mem
      if batch_size_mem is None:
          batch_size_mem = strategy.train_mb_size
  
      strategy.dataloader = ReplayDataLoader(
          strategy.adapted_dataset,
          self.storage_policy.buffer,
          oversample_small_tasks=True,
          batch_size=batch_size,
          batch_size_mem=batch_size_mem,
          task_balanced_dataloader=self.task_balanced_dataloader,
          num_workers=num_workers,
          shuffle=shuffle,
      )
  
imports: from collections import defaultdict
  from typing import Dict, List, Optional, TYPE_CHECKING, Sequence, Set, SupportsInt
  from copy import deepcopy
  import torch
  from torch.utils.data import DataLoader
  from torch.optim.lr_scheduler import MultiStepLR
  from avalanche.benchmarks.utils import _taskaware_classification_subset, _concat_taskaware_classification_datasets
  from avalanche.benchmarks.utils.data import AvalancheDataset
  from avalanche.benchmarks.utils.data_loader import ReplayDataLoader
  from avalanche.training.plugins.strategy_plugin import SupervisedPlugin
  from avalanche.training.storage_policy import ExemplarsBuffer, ExperienceBalancedBuffer, ReservoirSamplingBuffer
  from avalanche.models.dynamic_modules import MultiTaskModule
  from avalanche.models.bic_model import BiasLayer
label_desc: Use image node_id 4 for calling the BiCPlugin obj's underlying member method code with example usage: obj.before_training_exp(strategy, num_workers, shuffle) without return types