Skip to content

Tuple

lerax.space.Tuple

Bases: AbstractSpace[tuple[Any, ...], None]

A cartesian product of spaces.

Attributes:

Name Type Description
spaces tuple[AbstractSpace, ...]

A tuple of the component spaces.

Parameters:

Name Type Description Default
spaces tuple[AbstractSpace, ...]

A tuple of the component spaces.

required

spaces instance-attribute

spaces: tuple[AbstractSpace, ...] = spaces

shape property

shape: None

flat_size property

flat_size: int

__contains__

__contains__(x: Any) -> bool

__init__

__init__(spaces: tuple[AbstractSpace, ...])

canonical

canonical() -> tuple[Any, ...]

sample

sample(*, key: Key, mask: None = None) -> tuple[Any, ...]

Returns a random sample from the space.

Parameters:

Name Type Description Default
key Key

A JAX PRNGKey.

required

Returns:

Type Description
tuple[Any, ...]

A tuple containing a random sample from each component space.

contains

contains(x: Any) -> Bool[Array, '']

Returns whether the given value is contained in the space.

Parameters:

Name Type Description Default
x Any

The value to check.

required

Returns:

Type Description
Bool[Array, '']

Whether the value is contained in the space.

__eq__

__eq__(other: object) -> bool

__repr__

__repr__() -> str

__hash__

__hash__() -> int

flatten_sample

flatten_sample(
    sample: tuple[Any, ...],
) -> Float[Array, " size"]

__getitem__

__getitem__(index: int) -> AbstractSpace

__len__

__len__() -> int