Skip to content

Discrete

lerax.space.Discrete

Bases: AbstractSpace[Int[Array, ''], Bool[Array, ' n']]

A space of finite discrete values.

Attributes:

Name Type Description
n int

The number of discrete values.

Parameters:

Name Type Description Default
n int

The number of discrete values.

required

n instance-attribute

n: int = n

shape property

shape: tuple[int, ...]

flat_size property

flat_size: int

__contains__

__contains__(x: Any) -> bool

__init__

__init__(n: int)

canonical

canonical() -> Int[Array, '']

sample

sample(
    *, mask: Bool[ArrayLike, " n"] | None = None, key: Key
) -> Int[Array, ""]

contains

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

__eq__

__eq__(other: object) -> bool

__repr__

__repr__() -> str

__hash__

__hash__() -> int

flatten_sample

flatten_sample(
    sample: Int[Array, ""],
) -> Float[Array, " 1"]