noether.data.base.subset

Classes

Subset

Wrapper around arbitrary noether.data.Dataset instances to only use a subset of the samples, similar to

Module Contents

class noether.data.base.subset.Subset(dataset, indices)

Bases: noether.data.base.wrapper.DatasetWrapper

Wrapper around arbitrary noether.data.Dataset instances to only use a subset of the samples, similar to torch.utils.Subset, but with support for individual getitem_* methods instead of the __getitem__ method.

Example

>>> from noether.data import SubsetWrapper, Dataset
>>> len(dataset)  # 10
>>> subset = SubsetWrapper(dataset=dataset, indices=[0, 2, 5, 7])
>>> len(subset)  # 4
>>> subset[4]  # returns dataset[7]

Initializes the Subset wrapper.

Parameters:
indices