Skip to content

unienv_interface.space.spaces.batched

Implementation of a space consisting of finitely many elements.

BatchedSpace

BatchedSpace(single_space: Space[SpaceDataT, BDeviceType, BDtypeType, BRNGType], batch_shape: Sequence[int])

Bases: Space[ndarray, BDeviceType, BDtypeType, BRNGType]

This space represents a batch of

batch_shape instance-attribute

batch_shape = batch_shape

single_space instance-attribute

single_space = single_space

backend instance-attribute

backend = backend

dtype instance-attribute

dtype = dtype

device property

device: Optional[_SpaceBDeviceT]

shape property

shape: tuple[int, ...] | None

Return the shape of the space as an immutable property.

to

to(backend=None, device=None)

sample

sample(rng: BRNGType) -> Tuple[BRNGType, BArrayType]

create_empty

create_empty()

is_bounded

is_bounded(manner='both')

contains

contains(x: BArrayType) -> bool

get_repr

get_repr(abbreviate=False, include_backend=True, include_device=True, include_dtype=True)

data_to

data_to(data, backend=None, device=None)

abbr_device staticmethod

abbr_device(spaces: Iterable[Space[Any, _SpaceBDeviceT, _SpaceBDTypeT, _SpaceBDRNGT]]) -> Optional[_SpaceBDeviceT]

Return the shared device across spaces, or None if mixed/empty.