unienv_data.storages.npz_storage¶
Classes:
| Name | Description |
|---|---|
NPZStorage |
|
NPZStorage
¶
NPZStorage(
single_instance_space: BoxSpace[BArrayType, BDeviceType, BDtypeType, BRNGType],
compressed: bool,
cache_filename: Union[str, PathLike],
mutable: bool = True,
capacity: Optional[int] = None,
length: int = 0,
)
Bases: ListStorageBase[BArrayType, BArrayType, BDeviceType, BDtypeType, BRNGType]
Methods:
| Name | Description |
|---|---|
create |
|
load_from |
|
get_from_file |
|
set_to_file |
|
dumps |
|
close |
|
get_segments |
|
mark_segment_start |
|
append |
Append one structured sample to the storage. |
mark_segment_end |
|
abort_segment |
|
extend_length |
|
shrink_length |
|
get |
|
set |
|
open_segment_writer |
A writer that builds one segment of this storage off to the side; see |
clear |
|
get_single |
|
set_single |
|
Attributes:
| Name | Type | Description |
|---|---|---|
compressed |
|
|
single_file_ext |
|
|
capacity |
|
|
cache_filename |
Union[str, PathLike]
|
|
is_multiprocessing_safe |
bool
|
|
is_mutable |
|
|
backend |
ComputeBackend[BArrayType, BDeviceType, BDtypeType, BRNGType]
|
|
device |
Optional[BDeviceType]
|
|
single_instance_space |
|
|
has_open_segment |
bool
|
|
pending_segment_length |
int
|
|
file_ext |
|
|
length |
|
create
classmethod
¶
create(
single_instance_space: BoxSpace[BArrayType, BDeviceType, BDtypeType, BRNGType],
*args,
compressed: bool = True,
capacity: Optional[int] = None,
cache_path: Optional[str] = None,
multiprocessing: bool = False,
**kwargs,
) -> NPZStorage[BArrayType, BDeviceType, BDtypeType, BRNGType]
load_from
classmethod
¶
load_from(
path: Union[str, PathLike],
single_instance_space: BoxSpace[BArrayType, BDeviceType, BDtypeType, BRNGType],
*,
capacity: Optional[int] = None,
read_only: bool = True,
multiprocessing: bool = False,
**kwargs,
) -> NPZStorage[BArrayType, BDeviceType, BDtypeType, BRNGType]
append
¶
Append one structured sample to the storage.
Appended values may be immediately visible or only visible after
mark_segment_end() depending on the storage implementation.
open_segment_writer
¶
open_segment_writer() -> SegmentWriter
A writer that builds one segment of this storage off to the side; see SegmentWriter.
Unlike mark_segment_start() / append(), any number of writers can be open at a time.
The default keeps the samples in memory until the commit; storages override it to stream instead.