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§
- Compiled
Step - One step of a compiled environment (the fields of
crate::Step). - EnvFunctions
- The functions of an environment, from which
generate_from_functionsgenerates aCompiledEnv: traced from anEnvironment(asgeneratedoes) or imported from JAX (ruxla-import,crate::jax_env). The parameters are fixed (constants of the functions); keys areu32[2], and states and observations are tuples of leaves. - Step
Info - The scalars of a step of
CompiledEnv::step_in_place.
Traits§
- Compiled
Action - An action of a compiled environment.
- Compiled
Env - An environment compiled by
generate:resetandstep(with the automatic reset ofEnvironment::step) with the parameters fixed at generation, on states of fixed-size arrays. Keys are the two words of a JAX key (seekeyandsplit_key). - Visitor
- A computation on a compiled environment, called with the environment’s
type (by
ruxla_env_jax::visitfor an environment chosen by name).
Functions§
- generate
- Generates the Rust module
moduleofenvcompiled ahead of time with its default parameters: a unit structEnvthat implementsCompiledEnv, withStateandObsstructs. The code refers to the cratesruxla_env,ruxla_codegen, andruxla_ir. - generate_
from_ functions - Generates the Rust module
moduleof an environment given by its functions, asgeneratedoes for anEnvironment. - key
- The key of
jax.random.key(seed)(asrandom::key). - split_
key jax.random.split(key), unpacked (asrandom::split2).