Struct burn_core::optim::GradientsAccumulator
source · pub struct GradientsAccumulator<M> { /* private fields */ }Expand description
Accumulate gradients into a single Gradients object.
Implementations§
source§impl<M> GradientsAccumulator<M>
impl<M> GradientsAccumulator<M>
source§impl<M> GradientsAccumulator<M>
impl<M> GradientsAccumulator<M>
sourcepub fn accumulate<B: AutodiffBackend>(
&mut self,
module: &M,
grads: GradientsParams
)where
M: AutodiffModule<B>,
pub fn accumulate<B: AutodiffBackend>( &mut self, module: &M, grads: GradientsParams )where M: AutodiffModule<B>,
Accumulate the given gradients for each parameter in the given module.
sourcepub fn grads(&mut self) -> GradientsParams
pub fn grads(&mut self) -> GradientsParams
Return the accumulated gradients and reset the accumulator state.
Trait Implementations§
Auto Trait Implementations§
impl<M> !RefUnwindSafe for GradientsAccumulator<M>
impl<M> Send for GradientsAccumulator<M>where M: Send,
impl<M> Sync for GradientsAccumulator<M>where M: Sync,
impl<M> Unpin for GradientsAccumulator<M>where M: Unpin,
impl<M> !UnwindSafe for GradientsAccumulator<M>
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