avalanche.models.as_multitask

avalanche.models.as_multitask(model: torch.nn.modules.module.Module, classifier_name: str) avalanche.models.dynamic_modules.MultiTaskModule[source]

Wraps around a model to make it a multitask model

Parameters
  • model – model to be converted into MultiTaskModule

  • classifier_name – the name of the attribute containing the classification layer (nn.Linear). It can also be an instance of nn.Sequential containing multiple layers as long as the classification layer is the last layer.

:return the decorated model, now subclassing MultiTaskModule, and accepting task_labels as forward() method argument