torchwrench.utils.data.dataset package

class torchwrench.utils.data.dataset.DatasetSlicer(*, add_slice_support: bool = True, add_indices_support: bool = True, add_mask_support: bool = True, add_none_support: bool = True)[source]

Bases: Generic[T], ABC, Dataset[T]

abstractmethod get_item(idx, /, *args, **kwargs) Any[source]
get_items_indices(indices: Iterable[int] | Tensor | ndarray, *args) list[T][source]
get_items_mask(mask: Iterable[bool] | Tensor | ndarray, *args) list[T][source]
get_items_none(none: None, *args) list[T][source]
get_items_slice(slice_: slice, *args) list[T][source]
class torchwrench.utils.data.dataset.DatasetSlicerWrapper(dataset: SupportsGetitemLen[T, Any], *, add_slice_support: bool = True, add_indices_support: bool = True, add_mask_support: bool = True, add_none_support: bool = True)[source]

Bases: Generic[T], DatasetSlicer[T], Wrapper[T]

get_item(idx: int, *args) T[source]
class torchwrench.utils.data.dataset.EmptyDataset[source]

Bases: Dataset[None]

Dataset placeholder. Raises StopIteration if __getitem__ is called.

class torchwrench.utils.data.dataset.IterableSubset(dataset: SupportsGetitemLen[T, Any] | SupportsIterLen[T], indices: Iterable[int] | LongTensor1D)[source]

Bases: IterableWrapper[T], Generic[T]

class torchwrench.utils.data.dataset.IterableTransformWrapper(dataset: SupportsGetitemLen[T, Any] | SupportsIterLen[T], transform: Callable[[T], U] | None, condition: Callable[[T, int], bool] | None = None)[source]

Bases: IterableWrapper[T], Generic[T, U]

property condition : Callable[[T, int], bool] | None
property transform : Callable[[T], U] | None
class torchwrench.utils.data.dataset.IterableWrapper(dataset: SupportsGetitemLen[T, Any] | SupportsIterLen[T])[source]

Bases: Generic[T], IterableDataset[T], _WrapperBase[T]

class torchwrench.utils.data.dataset.Subset(dataset: SupportsGetitemLen[T, Any], indices: Iterable[int])[source]

Bases: Generic[T], Subset[T], Wrapper[T]

class torchwrench.utils.data.dataset.TabularDataset(data: Mapping[Any, SupportsGetitemIterLen] | SupportsGetitemIterLen[dict[Any, Any], Any] | DataFrame | Tensor | ndarray | DynamicItemDataset | TabularDatasetInterface[T_RowIndex, T_ColIndex], row_mapper: Mapping[T_RowIndex, T_RowIndex] | None = None, col_mapper: MutableMapping[T_ColIndex, T_ColIndex] | None = None, fns_list: Iterable[tuple[tuple[T_ColIndex, ...] | T_ColIndex, tuple[T_ColIndex, ...] | T_ColIndex, Callable]] = ())[source]

Bases: Generic[T_RowIndex, T_ColIndex], TabularDatasetInterface[T_RowIndex, T_ColIndex]

add_dynamic_column(fn: Callable, requires: tuple[T_ColIndex, ...], provides: T_ColIndex | tuple[T_ColIndex, ...], add_to_output_keys: bool = True) None[source]
property column_names : SupportsGetitemIterLen
classmethod from_csv(fpath: str | Path | TextIOBase, **kwds) Self[source]
classmethod from_json(fpath: str | Path | TextIOBase, **kwds) Self[source]
property row_names : SupportsGetitemIterLen
to_csv(fpath: str | Path, *args, **kwargs) None[source]
to_dataframe() DataFrame[source]
to_dict_list() dict[T_ColIndex, list][source]
to_json(fpath: str | Path, *args, **kwargs) None[source]
to_list_dict() list[dict[T_ColIndex, Any]][source]
to_numpy() ndarray[source]
to_tensor() Tensor[source]
class torchwrench.utils.data.dataset.TransformWrapper(dataset: SupportsGetitemLen[T, Any], transform: Callable[[T], U] | None, condition: Callable[[T, int], bool] | None = None)[source]

Bases: Generic[T, U], Wrapper[T]

property condition : Callable[[T, int], bool] | None
property transform : Callable[[T], U] | None
class torchwrench.utils.data.dataset.Wrapper(dataset: Any)[source]

Bases: Generic[T], _WrapperBase[T]

Submodules