Skip to content

utils

ContinualDataset

Bases: torch.utils.data.Dataset

Source code in sequel/benchmarks/utils.py
 9
10
11
12
13
14
15
16
17
18
19
20
21
class ContinualDataset(torch.utils.data.Dataset):
    def __init__(self, task_id: int, *args, **kwargs) -> None:
        """Inits the ContinualDataset class.

        Args:
            task_id (int): The id of the current task.
        """
        super().__init__(*args, **kwargs)
        self.task_id = task_id

    def __getitem__(self, index: int) -> Tuple[Tensor, Union[Tensor, int], int]:
        x, y = super().__getitem__(index=index)
        return x, y, self.task_id

__init__(task_id, *args, **kwargs)

Inits the ContinualDataset class.

Parameters:

Name Type Description Default
task_id int

The id of the current task.

required
Source code in sequel/benchmarks/utils.py
10
11
12
13
14
15
16
17
def __init__(self, task_id: int, *args, **kwargs) -> None:
    """Inits the ContinualDataset class.

    Args:
        task_id (int): The id of the current task.
    """
    super().__init__(*args, **kwargs)
    self.task_id = task_id