Skip to content

unienv_interface.space.spaces.tuple

Implementation of a space that represents the cartesian product of other spaces.

TupleSpace

TupleSpace(backend: ComputeBackend[Any, BDeviceType, BDtypeType, BRNGType], spaces: Iterable[Space[Any, BDeviceType, BDtypeType, BRNGType]], device: Optional[BDeviceType] = None)

Bases: Space[Tuple[Any, ...], BDeviceType, BDtypeType, BRNGType]

spaces instance-attribute

spaces: Tuple[Space[Any, BDeviceType, BDtypeType, BRNGType], ...] = tuple(new_spaces)

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, Tuple[Any, ...]]

create_empty

create_empty() -> Tuple[Any, ...]

Create an empty data structure for this space.

is_bounded

is_bounded(manner='both')

contains

contains(x: Tuple[Any, ...]) -> 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.