Struct InterpolateOptions
pub struct InterpolateOptions {
pub mode: InterpolateMode,
pub align_corners: bool,
pub output_size: Option<[usize; 2]>,
pub scale_factor: Option<[f32; 2]>,
}Expand description
Interpolation options.
Fields§
§mode: InterpolateModeAlgorithm used.
align_corners: boolIf true, the input and output tensors are aligned by their corner pixels.
If false, half-pixel coordinate mapping is used instead.
output_size: Option<[usize; 2]>Output spatial size [height, width].
Exactly one of output_size or scale_factor must be set when calling
burn_tensor::module::interpolate. Backends receive the resolved size as a
separate argument and ignore this field.
scale_factor: Option<[f32; 2]>Scale factor [scale_height, scale_width] applied to the input spatial size.
The output size is floor(input_size * scale_factor).
Exactly one of output_size or scale_factor must be set when calling
burn_tensor::module::interpolate. Backends ignore this field.
Implementations§
§impl InterpolateOptions
impl InterpolateOptions
pub fn new(mode: InterpolateMode) -> InterpolateOptions
pub fn new(mode: InterpolateMode) -> InterpolateOptions
Create new interpolate options with the given mode.
Defaults to align_corners = true and no output size or scale factor.
pub fn with_align_corners(self, align_corners: bool) -> InterpolateOptions
pub fn with_align_corners(self, align_corners: bool) -> InterpolateOptions
Set align_corners.
pub fn with_output_size(self, output_size: [usize; 2]) -> InterpolateOptions
pub fn with_output_size(self, output_size: [usize; 2]) -> InterpolateOptions
Set the output size [height, width], clearing any scale factor.
pub fn with_scale_factor(self, scale_factor: [f32; 2]) -> InterpolateOptions
pub fn with_scale_factor(self, scale_factor: [f32; 2]) -> InterpolateOptions
Set the scale factor [scale_height, scale_width], clearing any output size.
Trait Implementations§
§impl Clone for InterpolateOptions
impl Clone for InterpolateOptions
§fn clone(&self) -> InterpolateOptions
fn clone(&self) -> InterpolateOptions
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for InterpolateOptions
impl Debug for InterpolateOptions
§impl From<InterpolateOptions> for InterpolateOptionsIr
impl From<InterpolateOptions> for InterpolateOptionsIr
§fn from(val: InterpolateOptions) -> InterpolateOptionsIr
fn from(val: InterpolateOptions) -> InterpolateOptionsIr
§impl From<InterpolateOptionsIr> for InterpolateOptions
impl From<InterpolateOptionsIr> for InterpolateOptions
§fn from(val: InterpolateOptionsIr) -> InterpolateOptions
fn from(val: InterpolateOptionsIr) -> InterpolateOptions
Auto Trait Implementations§
impl Freeze for InterpolateOptions
impl RefUnwindSafe for InterpolateOptions
impl Send for InterpolateOptions
impl Sync for InterpolateOptions
impl Unpin for InterpolateOptions
impl UnsafeUnpin for InterpolateOptions
impl UnwindSafe for InterpolateOptions
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<K, Q> Comparable<Q> for K
impl<K, Q> Comparable<Q> for K
§impl<K, Q> Equivalent<Q> for K
impl<K, Q> Equivalent<Q> for K
§fn equivalent(&self, key: &Q) -> bool
fn equivalent(&self, key: &Q) -> bool
key and return true if they are equal.impl<T> ErasedDestructor for Twhere
T: 'static,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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