Module Space.Discrete

type element = (int32, Nx.int32_elt) Nx.t

Discrete action represented as a scalar int32 tensor.

val create : ?start:int -> int -> element t

create ?start n is a discrete space with n choices in the range [start; start + n - 1]. start defaults to 0.

Raises Invalid_argument if n <= 0.

val n : element t -> int

n s is the number of choices in s.

Raises Invalid_argument if s is not a discrete space.

val start : element t -> int

start s is the starting value of s.

Raises Invalid_argument if s is not a discrete space.

val to_int : element -> int

to_int e is the integer value of the discrete element e.

val of_int : int -> element

of_int v is a discrete element with value v.