noether.data.base.subset¶
Classes¶
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.DatasetWrapperWrapper 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:
dataset (noether.data.base.dataset.Dataset) – The base dataset to be wrapped
indices (collections.abc.Sequence[int] | numpy.typing.NDArray[numpy.integer]) – valid indices of the wrapped dataset (list, tuple, or numpy array)
- indices¶