Skip to main content

TrainingSession

Struct TrainingSession 

Source
pub struct TrainingSession { /* private fields */ }
Expand description

Cloneable, thread-safe command and observation handle for one training loop.

Attach it to exactly one super::Training instance. Clones may enqueue commands and read bounded evidence from UI, viewer, or service threads.

Implementations§

Source§

impl TrainingSession

Source

pub fn new(config: TrainingSessionConfig) -> Self

Construct an unattached live-control handle.

Source

pub fn enqueue(&self, command: TrainingCommand) -> Result<u64>

Enqueue one command without blocking.

§Errors

Returns ErrorKind::ResourceExhausted when the bounded queue is full.

Source

pub fn pause(&self, expected_revision: u64) -> Result<u64>

Enqueue a pause request.

Source

pub fn resume(&self, expected_revision: u64) -> Result<u64>

Enqueue a resume request.

Source

pub fn stop(&self, expected_revision: u64) -> Result<u64>

Enqueue a stop request.

Source

pub fn checkpoint(&self, expected_revision: u64) -> Result<u64>

Enqueue a checkpoint request.

Source

pub fn evaluate(&self, expected_revision: u64) -> Result<u64>

Enqueue an evaluation request.

Source

pub fn set_parameter( &self, name: impl Into<String>, value: TrainingValue, expected_revision: u64, ) -> Result<u64>

Enqueue a typed parameter update.

Source

pub fn request_recapture(&self, expected_revision: u64) -> Result<u64>

Enqueue a captured-program recapture request.

Source

pub fn request_rebuild( &self, value: TrainingValue, expected_revision: u64, ) -> Result<u64>

Enqueue an application-owned rebuild request.

Source

pub fn publish_metric(&self, name: impl Into<String>, value: f64)

Publish or replace a named finite scalar for subsequent snapshots.

Source

pub fn parameter(&self, name: &str) -> Option<TrainingValue>

Return the most recently cached value of a registered parameter.

Source

pub fn state(&self) -> TrainingState

Return the current live state.

Source

pub fn revision(&self) -> u64

Return the current optimistic-concurrency revision.

Source

pub fn current_snapshot(&self) -> TrainingSessionSnapshot

Combine the live state and revision with the latest published metrics.

Source

pub fn latest_snapshot(&self) -> Option<TrainingSessionSnapshot>

Return the latest published lifecycle snapshot.

Source

pub fn results_after(&self, sequence: u64) -> Vec<TrainingCommandResult>

Return retained results newer than an observer-owned sequence cursor.

Source

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.

Trait Implementations§

Source§

impl Clone for TrainingSession

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for TrainingSession

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Forget for TrainingSession

§

impl Freeze for TrainingSession
where *const ArcInner<Shared> is !null: Freeze, PhantomData<ArcInner<Shared>>: Freeze,

§

impl Move for TrainingSession

§

impl RefUnwindSafe for TrainingSession

§

impl Send for TrainingSession
where Arc<Shared>: Send,

§

impl Sync for TrainingSession
where Arc<Shared>: Sync,

§

impl Unpin for TrainingSession
where Arc<Shared>: Unpin,

§

impl UnsafeUnpin for TrainingSession
where *const ArcInner<Shared> is !null: UnsafeUnpin, PhantomData<ArcInner<Shared>>: UnsafeUnpin,

§

impl UnwindSafe for TrainingSession
where Arc<Shared>: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<S> FromSample<S> for S

Source§

fn from_sample_(s: S) -> S

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<F, T> IntoSample<T> for F
where T: FromSample<F>,

Source§

fn into_sample(self) -> T

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

Source§

fn to_sample_(self) -> U

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.