pub struct ParameterAverager<A: Float, D: Dimension> { /* private fields */ }Expand description
Distributed parameter averager
Implementations§
Source§impl<A: Float + ScalarOperand + Debug + Send + Sync, D: Dimension + Send + Sync> ParameterAverager<A, D>
impl<A: Float + ScalarOperand + Debug + Send + Sync, D: Dimension + Send + Sync> ParameterAverager<A, D>
Sourcepub fn new(strategy: AveragingStrategy, numnodes: usize) -> Self
pub fn new(strategy: AveragingStrategy, numnodes: usize) -> Self
Create a new parameter averager
Sourcepub fn initialize(&mut self, params: &[Array<A, D>]) -> Result<()>
pub fn initialize(&mut self, params: &[Array<A, D>]) -> Result<()>
Initialize averager with parameter shapes
Sourcepub fn set_node_weight(&mut self, nodeid: usize, weight: A) -> Result<()>
pub fn set_node_weight(&mut self, nodeid: usize, weight: A) -> Result<()>
Set weight for a specific node
Sourcepub fn average_parameters(
&mut self,
nodeparameters: &[(usize, Vec<Array<A, D>>)],
) -> Result<()>
pub fn average_parameters( &mut self, nodeparameters: &[(usize, Vec<Array<A, D>>)], ) -> Result<()>
Average parameters from multiple nodes
Sourcepub fn get_averaged_parameters(&self) -> &[Array<A, D>] ⓘ
pub fn get_averaged_parameters(&self) -> &[Array<A, D>] ⓘ
Get current averaged parameters
Sourcepub fn get_averaged_parameters_cloned(&self) -> Vec<Array<A, D>> ⓘ
pub fn get_averaged_parameters_cloned(&self) -> Vec<Array<A, D>> ⓘ
Get cloned averaged parameters
Sourcepub fn step_count(&self) -> usize
pub fn step_count(&self) -> usize
Get step count
Sourcepub fn strategy(&self) -> AveragingStrategy
pub fn strategy(&self) -> AveragingStrategy
Get averaging strategy
Sourcepub fn is_initialized(&self) -> bool
pub fn is_initialized(&self) -> bool
Check if initialized
Trait Implementations§
Auto Trait Implementations§
impl<A, D> Freeze for ParameterAverager<A, D>
impl<A, D> RefUnwindSafe for ParameterAverager<A, D>where
D: RefUnwindSafe,
A: RefUnwindSafe,
impl<A, D> Send for ParameterAverager<A, D>where
A: Send,
impl<A, D> Sync for ParameterAverager<A, D>where
A: Sync,
impl<A, D> Unpin for ParameterAverager<A, D>
impl<A, D> UnwindSafe for ParameterAverager<A, D>
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> 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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.