pub struct AggregatorSlot;Expand description
Generic Aggregator slot placeholder. Bind a concrete
AggregatorRuntime at compile time via
Compiler::new().bind_aggregator::<T>("slot"). Exposes
Contribute + Aggregate.
Both ops carry an opaque metadata channel alongside the
tensor: Contribute takes (contribution, metadata);
Aggregate returns (params, metadata). This is the channel
hierarchical aggregation rides on — a child aggregator emits
its summed num_samples (or whatever schema the impl uses) so
the parent layer’s reduction can weight the child’s
contribution correctly.
Implementations§
Source§impl AggregatorSlot
impl AggregatorSlot
Sourcepub fn contribute(
&self,
g: &mut Graph,
contribution: Output,
metadata: Output,
) -> Output
pub fn contribute( &self, g: &mut Graph, contribution: Output, metadata: Output, ) -> Output
Contribute(contribution, metadata) -> cmd - Shape 2
(buffer write). metadata is impl-defined bytes (e.g. a
sample count for FedAvg); pass an empty Output when the
impl has no metadata channel.
Sourcepub fn aggregate(&self, g: &mut Graph, trigger: Output) -> (Output, Output)
pub fn aggregate(&self, g: &mut Graph, trigger: Output) -> (Output, Output)
Aggregate(trigger) -> (params, metadata) - Shape 1 (mean /
weighted sum / replace expressible as ai.onnx). The output
edge fires only when the reduction completes; downstream
consumers read params AND the aggregation’s accompanying
metadata (e.g. summed num_samples for hierarchical
FedAvg) directly off the op’s two outputs — no separate
current_tensor read needed.
Trait Implementations§
Source§impl Clone for AggregatorSlot
impl Clone for AggregatorSlot
Source§fn clone(&self) -> AggregatorSlot
fn clone(&self) -> AggregatorSlot
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more