CollectionDataset

class torchhd.datasets.CollectionDataset(root: str, transform: Callable | None = None, target_transform: Callable | None = None, download: bool = False)[source]

Generic class for loading datasets used in Do we Need Hundreds of Classifiers to Solve Real World Classification Problems?.

Parameters:
  • root (string) – Root directory containing the files of the dataset.

  • transform (callable, optional) – A function/transform that takes in an torch.FloatTensor and returns a transformed version.

  • target_transform (callable, optional) – A function/transform that takes in the target and transforms it.

  • download (bool, optional) – If True, downloads the dataset from the internet and puts it in root directory. If dataset is already downloaded, it is not downloaded again.

Special-members:

__getitem__(index: int) Tuple[FloatTensor, LongTensor][source]
Parameters:

index (int) – Index

Returns:

(sample, target) where target is the index of the target class

Return type:

Tuple[torch.FloatTensor, torch.LongTensor]