pub struct CudaTrainingCheckpoint {
pub version: u32,
pub epoch: usize,
pub optimizer_step: usize,
pub shuffle_seed: Option<u64>,
pub input_size: usize,
pub layers: Vec<DenseLayer>,
pub loss: Loss,
pub optimizer: Optimizer,
pub adam_m_weights: Vec<Matrix>,
pub adam_v_weights: Vec<Matrix>,
pub adam_m_biases: Vec<Matrix>,
pub adam_v_biases: Vec<Matrix>,
}Expand description
Device-independent optimizer state for resuming CUDA fitting. It contains no CUDA handles or pointers and is safe to serialize as JSON.
Fields§
§version: u32§epoch: usize§optimizer_step: usize§shuffle_seed: Option<u64>§input_size: usize§layers: Vec<DenseLayer>§loss: Loss§optimizer: Optimizer§adam_m_weights: Vec<Matrix>§adam_v_weights: Vec<Matrix>§adam_m_biases: Vec<Matrix>§adam_v_biases: Vec<Matrix>Implementations§
Source§impl CudaTrainingCheckpoint
impl CudaTrainingCheckpoint
Sourcepub fn save_json<P: AsRef<Path>>(&self, path: P) -> Result<(), NetworkError>
pub fn save_json<P: AsRef<Path>>(&self, path: P) -> Result<(), NetworkError>
Writes the checkpoint as compact JSON straight into a buffered file.
to_string_pretty on a multi-megabyte optimizer state spends most of
its time emitting indentation that nothing reads back, and it has to
materialize the whole document in memory first; streaming the compact
form is the same data in roughly a third of the bytes.
pub fn load_json<P: AsRef<Path>>(path: P) -> Result<Self, NetworkError>
Trait Implementations§
Source§impl Clone for CudaTrainingCheckpoint
impl Clone for CudaTrainingCheckpoint
Source§impl Debug for CudaTrainingCheckpoint
impl Debug for CudaTrainingCheckpoint
Source§impl<'de> Deserialize<'de> for CudaTrainingCheckpoint
impl<'de> Deserialize<'de> for CudaTrainingCheckpoint
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for CudaTrainingCheckpoint
impl PartialEq for CudaTrainingCheckpoint
Source§impl Serialize for CudaTrainingCheckpoint
impl Serialize for CudaTrainingCheckpoint
impl StructuralPartialEq for CudaTrainingCheckpoint
Auto Trait Implementations§
impl Freeze for CudaTrainingCheckpoint
impl RefUnwindSafe for CudaTrainingCheckpoint
impl Send for CudaTrainingCheckpoint
impl Sync for CudaTrainingCheckpoint
impl Unpin for CudaTrainingCheckpoint
impl UnsafeUnpin for CudaTrainingCheckpoint
impl UnwindSafe for CudaTrainingCheckpoint
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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> ⓘ
Converts
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> ⓘ
Converts
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