Skip to main content

InterpolateDescriptor

Struct InterpolateDescriptor 

Source
#[non_exhaustive]
pub struct InterpolateDescriptor { pub n: i32, pub c: i32, pub ih: i32, pub iw: i32, pub oh: i32, pub ow: i32, pub mode: InterpolateMode, pub element: ElementKind, pub align_corners: bool, pub scale_h: Option<f64>, pub scale_w: Option<f64>, }
Expand description

Descriptor for an interpolate op.

#[non_exhaustive] (Phase 32) — Phase 21 added align_corners / scale_h / scale_w; future modes may add more fields. Use Self::new + the with_* setters from downstream code.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§n: i32

Batch.

§c: i32

Channels.

§ih: i32

Input height.

§iw: i32

Input width.

§oh: i32

Output height.

§ow: i32

Output width.

§mode: InterpolateMode

Interpolation mode.

§element: ElementKind

Value element type. Must match T::KIND.

§align_corners: bool

Coordinate alignment mode. false matches PyTorch F.interpolate new-code default; true matches nn.Upsample(align_corners=True).

§scale_h: Option<f64>

Per-axis SCALE override for height (output_size / input_size). None derives the scale from (ih, oh); Some(s) overrides and the kernel uses 1.0 / s per output coordinate. Matches PyTorch’s scale_factor semantics.

§scale_w: Option<f64>

Per-axis SCALE override for width (output_size / input_size). None derives the scale from (iw, ow); Some(s) overrides and the kernel uses 1.0 / s per output coordinate. Matches PyTorch’s scale_factor semantics.

Implementations§

Source§

impl InterpolateDescriptor

Source

pub fn new( n: i32, c: i32, ih: i32, iw: i32, oh: i32, ow: i32, mode: InterpolateMode, element: ElementKind, ) -> Self

Build a descriptor with align_corners = false (PyTorch F.interpolate new-code default) and scale_h / scale_w = None (derive scale from (ih, oh) / (iw, ow)). Chain with the with_* setters to override.

Source

pub fn with_align_corners(self, align_corners: bool) -> Self

Override align_corners. Default false.

Source

pub fn with_scale_h(self, scale_h: Option<f64>) -> Self

Override the per-axis SCALE for height. Default None (derive from (ih, oh)).

Source

pub fn with_scale_w(self, scale_w: Option<f64>) -> Self

Override the per-axis SCALE for width. Default None (derive from (iw, ow)).

Trait Implementations§

Source§

impl Clone for InterpolateDescriptor

Source§

fn clone(&self) -> InterpolateDescriptor

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for InterpolateDescriptor

Source§

impl Debug for InterpolateDescriptor

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.