unienv_data.batches.transformations¶
Classes:
| Name | Description |
|---|---|
TransformedBatch |
|
TransformedBatch
¶
TransformedBatch(
batch: BatchBase[
SourceDataT, SourceBArrT, SourceBDeviceT, SourceBDTypeT, SourceBDRNGT
],
transformation: DataTransformation,
metadata_transformation: Optional[DataTransformation] = None,
)
Bases: BatchBase[BatchT, BArrayType, BDeviceType, BDtypeType, BRNGType]
Methods:
| Name | Description |
|---|---|
get_flattened_at |
|
get_flattened_at_with_metadata |
|
set_flattened_at |
|
extend_flattened |
|
get_at |
|
get_at_with_metadata |
|
set_at |
|
remove_at |
|
extend |
|
close |
Release this view. The wrapped batch (and the transformation) are not owned by the view and stay open; |
append_flattened |
Append one flattened sample to the batch. |
append |
Append one structured sample to the batch. |
extend_from |
Copy data from another batch in bounded-size chunks. |
get_slice |
Create a lazy view over a subset of indices. |
get_column |
Create a lazy view over a nested field inside each sample. |
Attributes:
| Name | Type | Description |
|---|---|---|
batch |
|
|
transformation |
|
|
metadata_transformation |
|
|
backend |
ComputeBackend[BArrayType, BDeviceType, BDtypeType, BRNGType]
|
|
device |
Optional[BDeviceType]
|
|
is_mutable |
bool
|
|
single_space |
|
|
single_metadata_space |
|
metadata_transformation
instance-attribute
¶
metadata_transformation = (
metadata_transformation if self.batch.single_metadata_space is not None else None
)
get_flattened_at_with_metadata
¶
get_flattened_at_with_metadata(
idx: Union[IndexableType, BArrayType],
) -> Tuple[BArrayType, Optional[Dict[str, Any]]]
set_flattened_at
¶
set_flattened_at(idx: Union[IndexableType, BArrayType], value: BArrayType) -> None
get_at_with_metadata
¶
get_at_with_metadata(
idx: Union[IndexableType, BArrayType],
) -> Tuple[BatchT, Optional[Dict[str, Any]]]
close
¶
Release this view. The wrapped batch (and the transformation) are not owned by the view and stay open;
close them through whoever created it (BatchBase.__del__ calls close(), so
closing the source here would tear it down whenever a view is garbage-collected).
append_flattened
¶
Append one flattened sample to the batch.
extend_from
¶
extend_from(
other: BatchBase[BatchT, BArrayType, BDeviceType, BDtypeType, BRNGType],
chunk_size: int = 8,
tqdm: bool = False,
) -> None
Copy data from another batch in bounded-size chunks.
get_slice
¶
get_slice(
idx: Union[IndexableType, BArrayType],
) -> BatchBase[BatchT, BArrayType, BDeviceType, BDtypeType, BRNGType]
Create a lazy view over a subset of indices.