unienv_interface.space.spaces.union¶
Implementation of a space that represents the cartesian product of other spaces.
UnionSpace
¶
UnionSpace(backend: ComputeBackend[Any, BDeviceType, BDtypeType, BRNGType], spaces: Iterable[Space[Any, BDeviceType, BDtypeType, BRNGType]], device: Optional[BDeviceType] = None)
Bases: Space[Tuple[int, Any], BDeviceType, BDtypeType, BRNGType]
spaces
instance-attribute
¶
spaces = tuple(spaces if device is None else [(to(device=device)) for space in spaces])
shape
property
¶
shape: tuple[int, ...] | None
Return the shape of the space as an immutable property.
contains
¶
contains(x: Tuple[int, Any]) -> bool
Return boolean specifying if x is a valid member of this space.
get_repr
¶
get_repr(abbreviate: bool = False, include_backend=True, include_device=True, include_dtype=True)
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.