avalanche.models.as_multitask

avalanche.models.as_multitask(model: Module, classifier_name: str) 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.

Returns

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