pub enum IndexingPrimsDescriptor {
IndexSelect {
axis: usize,
},
Gather {
axis: usize,
},
Scatter {
axis: usize,
reduction: ScatterReduction,
},
IndexPut {
accumulate: bool,
},
}Expand description
Descriptor for indexing-family planning.
§Examples
use tenferro_prims::{IndexingPrimsDescriptor, ScatterReduction};
let desc = IndexingPrimsDescriptor::IndexSelect { axis: 0 };
assert!(matches!(desc, IndexingPrimsDescriptor::IndexSelect { .. }));
let desc = IndexingPrimsDescriptor::Scatter {
axis: 1,
reduction: ScatterReduction::Add,
};
assert!(matches!(desc, IndexingPrimsDescriptor::Scatter { .. }));Variants§
IndexSelect
Select slices along axis using a 1-D index tensor.
Given input of shape [d0, ..., d_{axis}, ..., d_{n-1}] and a 1-D
index tensor of length k, produces output of shape
[d0, ..., k, ..., d_{n-1}].
Gather
Gather elements along axis using an index tensor of the same rank.
The index tensor shape must match the output shape.
Scatter
Scatter source values into output positions along axis.
Inverse of gather: places values from source into output at
positions determined by the index tensor.
Fields
§
reduction: ScatterReductionReduction mode: overwrite or accumulate.
IndexPut
Put source values at index positions (flat or per-axis).
When accumulate is true, adds into the output instead of overwriting.
Trait Implementations§
Source§impl Clone for IndexingPrimsDescriptor
impl Clone for IndexingPrimsDescriptor
Source§fn clone(&self) -> IndexingPrimsDescriptor
fn clone(&self) -> IndexingPrimsDescriptor
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for IndexingPrimsDescriptor
impl Debug for IndexingPrimsDescriptor
Source§impl Hash for IndexingPrimsDescriptor
impl Hash for IndexingPrimsDescriptor
Source§impl PartialEq for IndexingPrimsDescriptor
impl PartialEq for IndexingPrimsDescriptor
impl Eq for IndexingPrimsDescriptor
impl StructuralPartialEq for IndexingPrimsDescriptor
Auto Trait Implementations§
impl Freeze for IndexingPrimsDescriptor
impl RefUnwindSafe for IndexingPrimsDescriptor
impl Send for IndexingPrimsDescriptor
impl Sync for IndexingPrimsDescriptor
impl Unpin for IndexingPrimsDescriptor
impl UnwindSafe for IndexingPrimsDescriptor
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
fn rand<T>(&self, rng: &mut (impl Rng + ?Sized)) -> Twhere
Self: Distribution<T>,
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