Struct LrSchedulerRecord
pub struct LrSchedulerRecord { /* private fields */ }Expand description
The serialized state of a learning rate scheduler, stored in the burnpack format.
Scheduler state is just a handful of scalars (step counters, current learning rate), so the
record holds named typed scalars and no tensors. Composed schedulers nest their children’s
records under an index prefix via with_record / record.
Implementations§
§impl LrSchedulerRecord
impl LrSchedulerRecord
pub fn new() -> LrSchedulerRecord
pub fn new() -> LrSchedulerRecord
Create an empty record.
pub fn with_scalar<V>(self, key: &str, value: V) -> LrSchedulerRecordwhere
V: Into<Scalar>,
pub fn with_scalar<V>(self, key: &str, value: V) -> LrSchedulerRecordwhere
V: Into<Scalar>,
Store a scalar under key.
pub fn scalar<V>(&self, key: &str) -> Option<V>where
V: TryFrom<Scalar>,
pub fn scalar<V>(&self, key: &str) -> Option<V>where
V: TryFrom<Scalar>,
Read the scalar stored under key, if present and of a compatible type.
pub fn with_record(
self,
prefix: &str,
record: LrSchedulerRecord,
) -> LrSchedulerRecord
pub fn with_record( self, prefix: &str, record: LrSchedulerRecord, ) -> LrSchedulerRecord
Merge a child record’s scalars under prefix (used to compose schedulers).
pub fn record(&self, prefix: &str) -> LrSchedulerRecord
pub fn record(&self, prefix: &str) -> LrSchedulerRecord
Extract the child record previously merged under prefix.
pub fn from_state<S>(state: &S) -> LrSchedulerRecordwhere
S: RecordState,
pub fn from_state<S>(state: &S) -> LrSchedulerRecordwhere
S: RecordState,
Build a record from a scheduler state.
Scheduler state is scalar-only, so this reuses the same RecordState decomposition as
optimizer states (it panics in debug builds if a tensor leaf is produced).
pub fn into_state<S>(&self) -> Option<S>where
S: RecordState,
pub fn into_state<S>(&self) -> Option<S>where
S: RecordState,
Reconstruct a scheduler state from this record.
Uses the default device; scheduler state is scalar-only so no tensor is ever allocated.
pub fn into_bytes(self) -> Result<Bytes, RecordError>
pub fn into_bytes(self) -> Result<Bytes, RecordError>
Serialize the record to an in-memory burnpack byte buffer.
pub fn from_bytes(bytes: Bytes) -> Result<LrSchedulerRecord, RecordError>
pub fn from_bytes(bytes: Bytes) -> Result<LrSchedulerRecord, RecordError>
Reconstruct a record from an in-memory burnpack byte buffer.
pub fn save<P>(self, path: P) -> Result<(), RecordError>
pub fn save<P>(self, path: P) -> Result<(), RecordError>
Save the record to a burnpack file on disk.
pub fn load<P>(path: P) -> Result<LrSchedulerRecord, RecordError>
pub fn load<P>(path: P) -> Result<LrSchedulerRecord, RecordError>
Load the record from a burnpack file on disk.
Trait Implementations§
§impl Checkpoint for LrSchedulerRecord
impl Checkpoint for LrSchedulerRecord
§fn load(path: PathBuf) -> Result<LrSchedulerRecord, CheckpointerError>
fn load(path: PathBuf) -> Result<LrSchedulerRecord, CheckpointerError>
path.§fn checkpoint_from_bytes(bytes: Bytes) -> Result<LrSchedulerRecord, RecordError>
fn checkpoint_from_bytes(bytes: Bytes) -> Result<LrSchedulerRecord, RecordError>
§fn checkpoint_into_bytes(self) -> Result<Bytes, RecordError>
fn checkpoint_into_bytes(self) -> Result<Bytes, RecordError>
§impl Clone for LrSchedulerRecord
impl Clone for LrSchedulerRecord
§fn clone(&self) -> LrSchedulerRecord
fn clone(&self) -> LrSchedulerRecord
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for LrSchedulerRecord
impl Debug for LrSchedulerRecord
§impl Default for LrSchedulerRecord
impl Default for LrSchedulerRecord
§fn default() -> LrSchedulerRecord
fn default() -> LrSchedulerRecord
Auto Trait Implementations§
impl Freeze for LrSchedulerRecord
impl RefUnwindSafe for LrSchedulerRecord
impl Send for LrSchedulerRecord
impl Sync for LrSchedulerRecord
impl Unpin for LrSchedulerRecord
impl UnsafeUnpin for LrSchedulerRecord
impl UnwindSafe for LrSchedulerRecord
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<K, Q> Comparable<Q> for K
impl<K, Q> Comparable<Q> for K
§impl<K, Q> Equivalent<Q> for K
impl<K, Q> Equivalent<Q> for K
§fn equivalent(&self, key: &Q) -> bool
fn equivalent(&self, key: &Q) -> bool
key and return true if they are equal.impl<T> ErasedDestructor for Twhere
T: 'static,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().