continual_dataset#

Classes

class datasets.utils.continual_dataset.ContinualDataset(args)[source]#

Bases: object

A base class for defining continual learning datasets.

NAME#

the name of the dataset

Type:

str

SETTING#

the setting of the dataset

Type:

str

N_CLASSES_PER_TASK#

the number of classes per task

Type:

int

N_TASKS#

the number of tasks

Type:

int

N_CLASSES#

the number of classes

Type:

int

SIZE#

the size of the dataset

Type:

Tuple[int]

train_loader#

the training loader

Type:

DataLoader

test_loaders#

the test loaders

Type:

List[DataLoader]

i#

the current task

Type:

int

c_task#

the current task

Type:

int

args#

the arguments which contains the hyperparameters

Type:

Namespace

AVAIL_SCHEDS = ['multisteplr']#
NAME: str#
N_CLASSES: int#
N_CLASSES_PER_TASK: int#
N_TASKS: int#
SETTING: str#
SIZE: Tuple[int]#
static get_backbone()[source]#

Returns the backbone to be used for the current dataset.

Return type:

Module

static get_batch_size()[source]#

Returns the batch size to be used for the current dataset.

get_data_loaders()[source]#

Creates and returns the training and test loaders for the current task. The current training loader and all test loaders are stored in self. :return: the current training and test loaders

Return type:

Tuple[DataLoader, DataLoader]

static get_denormalization_transform()[source]#

Returns the transform used for denormalizing the current dataset.

Return type:

Module

get_epochs()[source]#

Returns the number of epochs to be used for the current dataset.

static get_loss()[source]#

Returns the loss to be used for the current dataset.

Return type:

Module

classmethod get_minibatch_size()[source]#

Returns the minibatch size to be used for the current dataset.

static get_normalization_transform()[source]#

Returns the transform used for normalizing the current dataset.

Return type:

Module

get_offsets(task_idx=None)[source]#

Compute the start and end class index for the current task.

Parameters:

task_idx (int) – the task index

Returns:

the start and end class index for the current task

Return type:

tuple

static get_scheduler(model, args)[source]#

Returns the scheduler to be used for the current dataset.

Return type:

_LRScheduler

static get_transform()[source]#

Returns the transform to be used for the current dataset.

Return type:

Module

Functions

datasets.utils.continual_dataset.store_masked_loaders(train_dataset, test_dataset, setting)[source]#

Divides the dataset into tasks.

datasets.utils.continual_dataset.train_dataset#

the training dataset

Type:

Dataset

datasets.utils.continual_dataset.test_dataset#

the test dataset

Type:

Dataset

datasets.utils.continual_dataset.setting#

the setting of the dataset

Type:

ContinualDataset

Returns:

the training and test loaders

Return type:

Tuple[DataLoader, DataLoader]