pub struct TrainingSession { /* private fields */ }Expand description
Cloneable, thread-safe command and observation handle for one training loop.
Attach it to exactly one super::ItTraining instance. Clones may enqueue
commands and read bounded evidence from UI, viewer, or service threads.
Implementations§
Source§impl TrainingSession
impl TrainingSession
Sourcepub fn new(config: TrainingSessionConfig) -> Self
pub fn new(config: TrainingSessionConfig) -> Self
Construct an unattached live-control handle.
Sourcepub fn enqueue(&self, command: TrainingCommand) -> Result<u64>
pub fn enqueue(&self, command: TrainingCommand) -> Result<u64>
Enqueue one command without blocking.
§Errors
Returns ErrorKind::ResourceExhausted when the bounded queue is full.
Sourcepub fn checkpoint(&self, expected_revision: u64) -> Result<u64>
pub fn checkpoint(&self, expected_revision: u64) -> Result<u64>
Enqueue a checkpoint request.
Sourcepub fn set_parameter(
&self,
name: impl Into<String>,
value: TrainingValue,
expected_revision: u64,
) -> Result<u64>
pub fn set_parameter( &self, name: impl Into<String>, value: TrainingValue, expected_revision: u64, ) -> Result<u64>
Enqueue a typed parameter update.
Sourcepub fn request_recapture(&self, expected_revision: u64) -> Result<u64>
pub fn request_recapture(&self, expected_revision: u64) -> Result<u64>
Enqueue a captured-program recapture request.
Sourcepub fn request_rebuild(
&self,
value: TrainingValue,
expected_revision: u64,
) -> Result<u64>
pub fn request_rebuild( &self, value: TrainingValue, expected_revision: u64, ) -> Result<u64>
Enqueue an application-owned rebuild request.
Sourcepub fn publish_metric(&self, name: impl Into<String>, value: f64)
pub fn publish_metric(&self, name: impl Into<String>, value: f64)
Publish or replace a named finite scalar for subsequent snapshots.
Sourcepub fn parameter(&self, name: &str) -> Option<TrainingValue>
pub fn parameter(&self, name: &str) -> Option<TrainingValue>
Return the most recently cached value of a registered parameter.
Sourcepub fn state(&self) -> TrainingState
pub fn state(&self) -> TrainingState
Return the current live state.
Sourcepub fn current_snapshot(&self) -> TrainingSessionSnapshot
pub fn current_snapshot(&self) -> TrainingSessionSnapshot
Combine the live state and revision with the latest published metrics.
Sourcepub fn latest_snapshot(&self) -> Option<TrainingSessionSnapshot>
pub fn latest_snapshot(&self) -> Option<TrainingSessionSnapshot>
Return the latest published lifecycle snapshot.
Sourcepub fn results_after(&self, sequence: u64) -> Vec<TrainingCommandResult>
pub fn results_after(&self, sequence: u64) -> Vec<TrainingCommandResult>
Return retained results newer than an observer-owned sequence cursor.
Sourcepub fn take_results(&self) -> Vec<TrainingCommandResult>
pub fn take_results(&self) -> Vec<TrainingCommandResult>
Return results not previously consumed through this convenience cursor.
This does not delete retained results and therefore cannot steal evidence
from independent observers using TrainingSession::results_after.