torchoutil.extras.hdf.dataset module

class HDFDataset(
hdf_fpath: str | Path,
transform: Callable[[T], U] | None = None,
keep_padding: Iterable[str] = (),
return_added_columns: bool = False,
open_hdf: bool = True,
cast: Literal['to_torch_or_builtin', 'to_torch_or_numpy', 'to_builtin', 'to_numpy_src', 'to_torch_src', 'none'] = 'none',
file_kwds: Dict[str, Any] | None = None,
)[source]

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

property added_columns: List[str]

Return the list of columns added by pack_to_hdf function.

property all_columns: List[str]

The name of all columns of the dataset.

at(
*args,
**kwargs,
) Any[source]

Deprecated: Use get_item method instead.

property attrs: HDFDatasetAttributes
close(
ignore_if_closed: bool = False,
remove_file: bool = False,
) None[source]
property column_names: List[str]

The name of each column of the dataset.

get_attrs() HDFDatasetAttributes[source]
get_column_dtype(
column_name: str,
) dtype[source]
get_column_shape(
column_name: str,
) Tuple[int, ...][source]
get_columns_shapes() Dict[str, Tuple[int, ...]][source]
get_hdf_fpath() Path[source]
get_hdf_keys() Tuple[str, ...][source]
get_item(
index: int,
column: None = None,
) T[source]
get_item(
index: Iterable[int] | slice | None,
column: str,
) List
get_item(
index: Iterable[int] | slice | None,
column: List[str] | None = None,
) Dict[str, List]
get_item(
index: Any,
column: Any,
raw: bool = False,
) Any
property info: Dict[str, Any]

Return the global dataset info.

is_closed() bool[source]
is_open() bool[source]
property item_type: Literal['dict', 'tuple']

Return the global dataset info.

property keep_padding: List[str]
property num_columns: int
property num_rows: int
open(
ignore_if_opened: bool = False,
) None[source]
property shape: Tuple[int, ...]

The shape of the Clotho dataset.

to_dict(
raw: bool = False,
) Dict[str, ndarray][source]
property transform: Callable[[T], U] | None
property user_attrs: Any