Skip to main content

Module compiled

Module compiled 

Source
Expand description

Environments compiled ahead of time to Rust: generate traces an environment’s reset and step (with the automatic reset), optimizes the IR, and writes a Rust module whose functions work on fixed-size arrays; a build script includes the module, and rustc compiles it like handwritten code. The module implements CompiledEnv.

Structs§

CompiledStep
One step of a compiled environment (the fields of crate::Step).
EnvFunctions
The functions of an environment, from which generate_from_functions generates a CompiledEnv: traced from an Environment (as generate does) or imported from JAX (ruxla-import, crate::jax_env). The parameters are fixed (constants of the functions); keys are u32[2], and states and observations are tuples of leaves.
StepInfo
The scalars of a step of CompiledEnv::step_in_place.

Traits§

CompiledAction
An action of a compiled environment.
CompiledEnv
An environment compiled by generate: reset and step (with the automatic reset of Environment::step) with the parameters fixed at generation, on states of fixed-size arrays. Keys are the two words of a JAX key (see key and split_key).
Visitor
A computation on a compiled environment, called with the environment’s type (by ruxla_env_jax::visit for an environment chosen by name).

Functions§

generate
Generates the Rust module module of env compiled ahead of time with its default parameters: a unit struct Env that implements CompiledEnv, with State and Obs structs. The code refers to the crates ruxla_env, ruxla_codegen, and ruxla_ir.
generate_from_functions
Generates the Rust module module of an environment given by its functions, as generate does for an Environment.
key
The key of jax.random.key(seed) (as random::key).
split_key
jax.random.split(key), unpacked (as random::split2).