pub struct GatherPlan { /* private fields */ }Expand description
A compiled gather traversal for one value layout, index layout, and output layout.
Implementations§
Source§impl GatherPlan
impl GatherPlan
Sourcepub fn compile(
operand_dims: &[usize],
operand_strides: &[isize],
index_dims: &[usize],
index_strides: &[isize],
dest_dims: &[usize],
dest_strides: &[isize],
spec: GatherSpec,
) -> Result<GatherPlan, StridedError>
pub fn compile( operand_dims: &[usize], operand_strides: &[isize], index_dims: &[usize], index_strides: &[isize], dest_dims: &[usize], dest_strides: &[isize], spec: GatherSpec, ) -> Result<GatherPlan, StridedError>
Compile a gather plan for fixed operand, index, and destination layouts.
§Errors
Returns StridedError::StrideLengthMismatch when a stride list does
not match its dimension list, StridedError::OffsetOverflow when an
element count or a layout span does not fit usize/isize,
StridedError::NonInjectiveOutputLayout when the destination layout
maps two logical indices onto one offset.
StridedError::RankMismatch reports spec.slice_sizes or
spec.offset_dims of the wrong length, or an index vector that does not
match spec.start_index_map;
StridedError::InvalidAxis reports collapsed_slice_dims,
start_index_map, or offset_dims that repeat or exceed their rank,
index_vector_dim beyond the index rank, a slice size beyond its
operand extent, or a collapsed axis whose slice size is not one; and
StridedError::ShapeMismatch reports a dest_dims that is not the
gathered window/batch shape.
pub fn spec(&self) -> &GatherSpec
pub fn dest_dims(&self) -> &[usize]
Sourcepub fn execute<T, I>(
&self,
dest: &mut RawStridedMut<'_, T>,
operand: &RawStridedRef<'_, T>,
start_indices: &RawStridedRef<'_, I>,
exec: Exec<'_>,
) -> Result<(), StridedError>
pub fn execute<T, I>( &self, dest: &mut RawStridedMut<'_, T>, operand: &RawStridedRef<'_, T>, start_indices: &RawStridedRef<'_, I>, exec: Exec<'_>, ) -> Result<(), StridedError>
Execute the prepared gather traversal.
§Errors
Returns StridedError::PlanLayoutMismatch when the operand, index,
or destination view does not carry its compiled extents and strides,
before any destination write, and
StridedError::OffsetOverflow when a replayed chunk’s offset
arithmetic cannot be represented. Start indices are clamped into the
operand window, so an out-of-range index is not an error. The offset
arithmetic runs per worker above the threading threshold, so a
destination split across workers may be partially written when that
error surfaces.
Trait Implementations§
Source§impl Clone for GatherPlan
impl Clone for GatherPlan
Source§fn clone(&self) -> GatherPlan
fn clone(&self) -> GatherPlan
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for GatherPlan
impl RefUnwindSafe for GatherPlan
impl Send for GatherPlan
impl Sync for GatherPlan
impl Unpin for GatherPlan
impl UnsafeUnpin for GatherPlan
impl UnwindSafe for GatherPlan
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> ⓘ
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> ⓘ
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