pub struct ErasedReducePlan { /* private fields */ }Expand description
Dtype-erased reduction wrapper.
This is the erased replay boundary for full-tensor scalar reductions and axis reductions with a fixed output layout. It supports only operations with an unambiguous identity value in the selected dtype.
Implementations§
Source§impl ErasedReducePlan
impl ErasedReducePlan
Sourcepub fn compile(
dtype: KernelDType,
op: ReduceOp,
dims: &[usize],
src_strides: &[isize],
) -> Result<Self>
pub fn compile( dtype: KernelDType, op: ReduceOp, dims: &[usize], src_strides: &[isize], ) -> Result<Self>
Validate and store a full-reduction plan for one dtype and source layout.
Sourcepub fn compile_axes(
dtype: KernelDType,
op: ReduceOp,
src_dims: &[usize],
src_strides: &[isize],
dest_dims: &[usize],
dest_strides: &[isize],
axes: &[usize],
) -> Result<Self>
pub fn compile_axes( dtype: KernelDType, op: ReduceOp, src_dims: &[usize], src_strides: &[isize], dest_dims: &[usize], dest_strides: &[isize], axes: &[usize], ) -> Result<Self>
Validate and store an axis-reduction plan for one dtype and fixed source/output layouts.
axes names the source axes reduced away. Output dimensions must be the
remaining source dimensions in source-axis order. When all axes are
reduced, any output layout with exactly one reachable element is accepted.
pub fn dtype(&self) -> KernelDType
pub fn op(&self) -> ReduceOp
Sourcepub fn execute(
&self,
ctx: &ExecContext,
dest: &mut ErasedRawStridedMut<'_>,
src: &ErasedRawStridedRef<'_>,
) -> Result<()>
pub fn execute( &self, ctx: &ExecContext, dest: &mut ErasedRawStridedMut<'_>, src: &ErasedRawStridedRef<'_>, ) -> Result<()>
Execute the reduction into an erased output descriptor.
Sourcepub fn execute_uninit(
&self,
ctx: &ExecContext,
dest: &mut ErasedRawStridedUninitMut<'_>,
src: &ErasedRawStridedPtr<'_>,
) -> Result<()>
pub fn execute_uninit( &self, ctx: &ExecContext, dest: &mut ErasedRawStridedUninitMut<'_>, src: &ErasedRawStridedPtr<'_>, ) -> Result<()>
On success, every reachable destination slot is fully overwritten;
unreachable holes are neither read nor initialized. Validation errors
are returned before any destination write. A panic during execution
may leave a partially initialized MaybeUninit destination, which is
still safely droppable; no readable value is promised for unwritten
reachable slots.
Trait Implementations§
Source§impl Clone for ErasedReducePlan
impl Clone for ErasedReducePlan
Source§fn clone(&self) -> ErasedReducePlan
fn clone(&self) -> ErasedReducePlan
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more