pub struct SegmentMeanPlan<T: Element> { /* private fields */ }Expand description
segment_mean plan (sorted).
out[s, d] = mean_{n : segment_ids[n] == s} input[n, d] (TF / JAX
segment_mean). Requires segment_ids monotonically non-decreasing.
When to use: forward sorted segment-mean. Pair with
SegmentMeanBackwardPlan.
Dtypes: {f32, f64}.
Shape limits: input [N, D]; segment_ids [N] with values
in [0, num_segments); output [num_segments, D].
Workspace: none — segment counts derived inline via binary search.
Precision guarantee: deterministic, bit-stable.
Index policy: out-of-range IDs dropped. Empty segments emit zero (division is guarded; no NaN).
Implementations§
Source§impl<T: Element> SegmentMeanPlan<T>
impl<T: Element> SegmentMeanPlan<T>
Sourcepub fn select(
_stream: &Stream,
desc: &SegmentMeanDescriptor,
_pref: PlanPreference,
) -> Result<Self>
pub fn select( _stream: &Stream, desc: &SegmentMeanDescriptor, _pref: PlanPreference, ) -> Result<Self>
Pick a kernel.
Sourcepub fn can_implement(&self, args: &SegmentMeanArgs<'_, T>) -> Result<()>
pub fn can_implement(&self, args: &SegmentMeanArgs<'_, T>) -> Result<()>
Validate args.
Sourcepub fn workspace_size(&self) -> usize
pub fn workspace_size(&self) -> usize
Workspace size — zero (count computed inline via binary search).
Sourcepub fn precision_guarantee(&self) -> PrecisionGuarantee
pub fn precision_guarantee(&self) -> PrecisionGuarantee
Numerical guarantees.
Auto Trait Implementations§
impl<T> Freeze for SegmentMeanPlan<T>
impl<T> RefUnwindSafe for SegmentMeanPlan<T>where
T: RefUnwindSafe,
impl<T> Send for SegmentMeanPlan<T>where
T: Send,
impl<T> Sync for SegmentMeanPlan<T>where
T: Sync,
impl<T> Unpin for SegmentMeanPlan<T>where
T: Unpin,
impl<T> UnsafeUnpin for SegmentMeanPlan<T>
impl<T> UnwindSafe for SegmentMeanPlan<T>where
T: UnwindSafe,
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