pub struct ErasedPadPlan { /* private fields */ }Expand description
Dtype-erased pad wrapper.
Implementations§
Source§impl ErasedPadPlan
impl ErasedPadPlan
Sourcepub fn compile(
dtype: KernelDType,
operand_dims: &[usize],
operand_strides: &[isize],
dest_dims: &[usize],
dest_strides: &[isize],
edge_padding_low: &[i64],
edge_padding_high: &[i64],
interior_padding: &[i64],
) -> Result<Self>
pub fn compile( dtype: KernelDType, operand_dims: &[usize], operand_strides: &[isize], dest_dims: &[usize], dest_strides: &[isize], edge_padding_low: &[i64], edge_padding_high: &[i64], interior_padding: &[i64], ) -> Result<Self>
Validate and store a pad plan for one dtype and fixed layout set.
§Errors
Returns StridedError::StrideLengthMismatch when the operand or
destination layout lengths differ from the operand rank,
StridedError::RankMismatch when the edge or interior padding
lengths differ from it, StridedError::InvalidAxis for a negative
interior padding or a padded extent that does not fit usize,
StridedError::ShapeMismatch when dest_dims is not the padded
extents, StridedError::NonInjectiveOutputLayout when the
destination layout cannot be proven injective, and
StridedError::OffsetOverflow when an element count, a padded
extent, or a cursor stride computation overflows.
pub fn dtype(&self) -> KernelDType
pub fn plan(&self) -> &PadPlan
Sourcepub fn execute(
&self,
dest: &mut ErasedRawStridedMut<'_>,
operand: &ErasedRawStridedRef<'_>,
fill: &[u8],
exec: Exec<'_>,
) -> Result<()>
pub fn execute( &self, dest: &mut ErasedRawStridedMut<'_>, operand: &ErasedRawStridedRef<'_>, fill: &[u8], exec: Exec<'_>, ) -> Result<()>
Execute pad into an erased output descriptor using one dtype scalar as fill.
§Errors
Returns StridedError::DTypeMismatch when dest or operand
carries a different dtype than the plan,
StridedError::ByteLengthMismatch when fill is not exactly one
element wide, StridedError::InvalidBoolByte when a bool fill
holds a byte other than 0 or 1, and
StridedError::PlanLayoutMismatch when a view does not carry the
compiled extents and strides. Nothing is written unless every check
succeeds.
Sourcepub fn execute_uninit(
&self,
dest: &mut ErasedRawStridedUninitMut<'_>,
operand: &ErasedRawStridedPtr<'_>,
fill: &[u8],
exec: Exec<'_>,
) -> Result<()>
pub fn execute_uninit( &self, dest: &mut ErasedRawStridedUninitMut<'_>, operand: &ErasedRawStridedPtr<'_>, fill: &[u8], exec: Exec<'_>, ) -> Result<()>
Execute pad as a full overwrite of uninitialized output storage.
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.
§Errors
Returns StridedError::DTypeMismatch when dest or operand
carries a different dtype than the plan,
StridedError::ByteLengthMismatch when fill is not exactly one
element wide, StridedError::InvalidBoolByte when a bool fill or
a bool operand holds a byte other than 0 or 1,
StridedError::OverlappingInputOutput when the input allocation
overlaps the destination, and
StridedError::PlanLayoutMismatch when a view does not carry the
compiled extents and strides. Every rejection above is returned before
any destination write.
Trait Implementations§
Source§impl Clone for ErasedPadPlan
impl Clone for ErasedPadPlan
Auto Trait Implementations§
impl Freeze for ErasedPadPlan
impl RefUnwindSafe for ErasedPadPlan
impl Send for ErasedPadPlan
impl Sync for ErasedPadPlan
impl Unpin for ErasedPadPlan
impl UnsafeUnpin for ErasedPadPlan
impl UnwindSafe for ErasedPadPlan
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