pub struct TrainedState {
pub params: Vec<Tensor>,
pub buffers: Vec<Tensor>,
}Expand description
Trained parameters and buffers returned by DdpHandle::join().
Contains the averaged final state from all workers. Parameters are on CPU. Buffers include running statistics (e.g. BatchNorm mean/var) needed for inference.
§Example
ⓘ
let state = ddp.join()?;
// state.params[i] corresponds to model.parameters()[i]
// state.buffers[i] corresponds to model.buffers()[i]Fields§
§params: Vec<Tensor>Averaged parameter tensors (CPU). Same order as Module::parameters().
buffers: Vec<Tensor>Averaged buffer tensors (CPU). Same order as Module::buffers().
Trait Implementations§
Source§impl Clone for TrainedState
impl Clone for TrainedState
Source§fn clone(&self) -> TrainedState
fn clone(&self) -> TrainedState
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for TrainedState
impl RefUnwindSafe for TrainedState
impl Send for TrainedState
impl Sync for TrainedState
impl Unpin for TrainedState
impl UnsafeUnpin for TrainedState
impl UnwindSafe for TrainedState
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