github ↗
docs menu

Module Space.Box

#type element = Nx.host Nx.float32_t

Continuous vector represented as a float32 tensor.

#val create : low:float array -> high:float array -> element t

create ~low ~high is a continuous space where element i satisfies low.(i) <= x.(i) <= high.(i). Both arrays must have the same positive length.

When the range of a dimension is not finite (e.g. bounds set to Float.max_float), sampling falls back to a uniform draw in [-1e6; 1e6] clamped to bounds.

Raises Invalid_argument if low is empty, if low and high differ in length, or if any low.(i) > high.(i).

#val bounds : element t -> float array * float array

bounds s is (low, high) copies of the bound vectors.

Raises Invalid_argument if s is not a box space.