Expand description
Core traits and data types shared by the r2l workspace.
r2l-core is the contracts crate. It defines the small set of interfaces
that environments, samplers, policies, agents, learners, and tensor
backends agree on. Backend-specific implementations live in crates such as
r2l-burn and r2l-candle; concrete algorithms and builders live outside
this crate as well.
Most downstream code should start with the prelude:
use r2l_core::prelude::*;The main extension points are:
EnvandEnvBuilderfor environment integrations.R2lTensorfor tensor types used by environments and learning code.Actor,Policy,ValueFunction, andLearnerfor model and optimizer components.TrajectoryBufferandTrajectoryViewfor rollout storage.Agent,Sampler, andOnPolicyAlgorithmfor on-policy training loops.
Modules§
- buffers
- Rollout transition and trajectory storage.
- env
- Environment traits and space descriptions.
- error
- Error types
- models
- Actor, policy, value-function, and learner traits.
- on_
policy - Shared interfaces for on-policy training loops. Shared contracts for on-policy algorithms.
- prelude
- Common imports for implementing environments, policies, agents, samplers, and learners.
- rng
- Reproducible random-number utilities.
- running_
mean - Online mean and variance estimators.
- tensor
- Backend-neutral tensor interfaces and adapters.
Macros§
- break_
on_ hook_ result - Breaks out of the surrounding loop when a hook requests
HookResult::Break. - return_
on_ hook_ result - Returns
Ok(())from the surrounding function when a hook requestsHookResult::Break.
Structs§
Enums§
- Hook
Result - Control-flow result returned by training hooks.