oa::ml::training::PpoTrainer

Complete caller-driven categorical PPO lifecycle. The Engine, model, and optimizer remain caller-owned. The trainer owns only its fixed-capacity rollout and lifecycle state. Drop performs no submission, waiting, or terminal callbacks; call PpoTrainer::finish explicitly.

StRust public API

Declaration

pub struct PpoTrainer<'engine, 'hooks> { /* private fields */ }
Public Rust declaration.

Public Methods

pub fn add_metric(&mut self, metric: &'hooks mut dyn TrainingMetric)
pub fn add_callback(&mut self, callback: &'hooks mut dyn TrainingCallback)
pub fn begin_collection(&mut self) -> Result<()>
pub fn act(&mut self, observation: &Matrix) -> Result<PolicyResult>
pub fn observe( &mut self, observation: &Matrix, next_observation: &Matrix, reward: &Matrix, terminated: &Matrix, truncated: &Matrix, policy_result: &PolicyResult, ) -> Result<()>
pub fn end_collection(&mut self) -> Result<()>
pub fn abort_collection(&mut self) -> Result<()>
pub fn update(&mut self) -> Result<bool>
pub fn needs_collection(&self) -> bool
pub fn is_done(&self) -> bool
pub const fn phase(&self) -> RolloutTrainingPhase
pub const fn config(&self) -> &PpoTrainerConfig
pub const fn metrics(&self) -> PpoTrainerMetrics
pub const fn batch(&self) -> &RolloutBatch
pub const fn training_loop(&self) -> &ItTraining<'engine, 'hooks>
pub fn finish(self) -> Result<TrainingSnapshot>

Associated Functions

pub fn new( engine: &'engine Engine, model: &'engine dyn ActorCritic, optimizer: &'engine mut dyn Optimizer, config: PpoTrainerConfig, ) -> Result<Self>

Public Method Documentation

pub fn add_metric( &mut self, metric: &'hooks mut dyn TrainingMetric )
No public source comment is attached to this declaration.
pub fn add_callback( &mut self, callback: &'hooks mut dyn TrainingCallback )
No public source comment is attached to this declaration.
pub fn begin_collection(&mut self) -> Result<()>
No public source comment is attached to this declaration.
pub fn act( &mut self, observation: &Matrix ) -> Result<PolicyResult>
No public source comment is attached to this declaration.
pub fn observe( &mut self, observation: &Matrix, next_observation: &Matrix, reward: &Matrix, terminated: &Matrix, truncated: &Matrix, policy_result: &PolicyResult, ) -> Result<()>
No public source comment is attached to this declaration.
pub fn end_collection(&mut self) -> Result<()>
No public source comment is attached to this declaration.
pub fn abort_collection(&mut self) -> Result<()>
No public source comment is attached to this declaration.
pub fn update( &mut self ) -> Result<bool>
No public source comment is attached to this declaration.
pub fn needs_collection( &self ) -> bool
No public source comment is attached to this declaration.
pub fn is_done( &self ) -> bool
No public source comment is attached to this declaration.
pub const fn phase( &self ) -> RolloutTrainingPhase
No public source comment is attached to this declaration.
pub const fn config( &self ) -> &PpoTrainerConfig
No public source comment is attached to this declaration.
pub const fn metrics( &self ) -> PpoTrainerMetrics
No public source comment is attached to this declaration.
pub const fn batch( &self ) -> &RolloutBatch
No public source comment is attached to this declaration.
pub const fn training_loop( &self ) -> &ItTraining<'engine, 'hooks>
No public source comment is attached to this declaration.
pub fn finish( self ) -> Result<TrainingSnapshot>
No public source comment is attached to this declaration.
pub fn new( engine: &'engine Engine, model: &'engine dyn ActorCritic, optimizer: &'engine mut dyn Optimizer, config: PpoTrainerConfig ) -> Result<Self>
No public source comment is attached to this declaration.