#[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
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.n: i32Batch.
c: i32Channels.
ih: i32Input height.
iw: i32Input width.
oh: i32Output height.
ow: i32Output width.
mode: InterpolateModeInterpolation mode.
element: ElementKindValue element type. Must match T::KIND.
align_corners: boolCoordinate 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
impl InterpolateDescriptor
Sourcepub fn new(
n: i32,
c: i32,
ih: i32,
iw: i32,
oh: i32,
ow: i32,
mode: InterpolateMode,
element: ElementKind,
) -> Self
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.
Sourcepub fn with_align_corners(self, align_corners: bool) -> Self
pub fn with_align_corners(self, align_corners: bool) -> Self
Override align_corners. Default false.
Sourcepub fn with_scale_h(self, scale_h: Option<f64>) -> Self
pub fn with_scale_h(self, scale_h: Option<f64>) -> Self
Override the per-axis SCALE for height. Default None (derive
from (ih, oh)).
Sourcepub fn with_scale_w(self, scale_w: Option<f64>) -> Self
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
impl Clone for InterpolateDescriptor
Source§fn clone(&self) -> InterpolateDescriptor
fn clone(&self) -> InterpolateDescriptor
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more