unienv_data.batches.subindex_batch¶
Classes:
| Name | Description |
|---|---|
SubIndexedBatch |
A batch that offers a view of the original batch with a fixed index range. |
SubIndexedBatch
¶
SubIndexedBatch(
batch: BatchBase[BatchT, BArrayType, BDeviceType, BDtypeType, BRNGType],
sub_indexes: Union[IndexableType, BArrayType],
)
Bases: BatchBase[BatchT, BArrayType, BDeviceType, BDtypeType, BRNGType]
A batch that offers a view of the original batch with a fixed index range. This does not support batch extension.
Methods:
| Name | Description |
|---|---|
get_flattened_at |
|
get_flattened_at_with_metadata |
|
get_at |
|
get_at_with_metadata |
|
set_at |
|
set_flattened_at |
|
extend |
|
extend_flattened |
|
close |
|
append_flattened |
Append one flattened sample to the batch. |
remove_at |
Remove one or more samples from 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 |
|
|
sub_indexes |
|
|
is_mutable |
bool
|
|
backend |
ComputeBackend[BArrayType, BDeviceType, BDtypeType, BRNGType]
|
|
device |
Optional[BDeviceType]
|
|
single_space |
|
|
single_metadata_space |
|
append_flattened
¶
Append one flattened sample to the batch.
remove_at
¶
remove_at(idx: Union[IndexableType, BArrayType]) -> None
Remove one or more samples from 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.