pub struct Hogwild { /* private fields */ }Expand description
Hogwild! optimizer for sparse features.
Implementations§
Source§impl Hogwild
impl Hogwild
Sourcepub fn new(
config: HogwildConfig,
worker_id: usize,
shared_parameters: Arc<RwLock<Vec<Tensor>>>,
) -> Self
pub fn new( config: HogwildConfig, worker_id: usize, shared_parameters: Arc<RwLock<Vec<Tensor>>>, ) -> Self
Create a new Hogwild! optimizer.
Sourcepub fn sparse_step(
&mut self,
sparse_gradients: &[(usize, Tensor)],
) -> Result<()>
pub fn sparse_step( &mut self, sparse_gradients: &[(usize, Tensor)], ) -> Result<()>
Perform sparse parameter update.
Sourcepub fn select_sparse_indices(&self, total_params: usize) -> Vec<usize>
pub fn select_sparse_indices(&self, total_params: usize) -> Vec<usize>
Generate sparse gradient indices based on sparse ratio.
Auto Trait Implementations§
impl Freeze for Hogwild
impl !RefUnwindSafe for Hogwild
impl Send for Hogwild
impl Sync for Hogwild
impl Unpin for Hogwild
impl !UnwindSafe for Hogwild
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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>
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