Skip to content

unienv_interface.space.spaces.text

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

alphanumeric module-attribute

alphanumeric: FrozenSet[str] = frozenset('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789')

TextSpace

TextSpace(backend: ComputeBackend[Any, BDeviceType, BDtypeType, BRNGType], max_length: int, *, min_length: int = 0, charset: Optional[FrozenSet[str] | str] = None, device: Optional[BDeviceType] = None)

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

min_length instance-attribute

min_length: int = min_length

max_length instance-attribute

max_length: int = max_length

charset property

charset: Optional[FrozenSet[str]]

charset_index property

charset_index: Optional[Mapping[str, int]]

charset_list property

charset_list: Optional[Tuple[str, ...]]

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)

character_index

character_index(char: str) -> Optional[int]

sample

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

create_empty

create_empty() -> str

is_bounded

is_bounded(manner='both')

contains

contains(x: 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.