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§
Source§impl InterpolateOptions
impl InterpolateOptions
Sourcepub fn new(mode: InterpolateMode) -> Self
pub fn new(mode: InterpolateMode) -> Self
Create new interpolate options with the given mode.
Defaults to align_corners = true and no output size or scale factor.
Sourcepub fn with_align_corners(self, align_corners: bool) -> Self
pub fn with_align_corners(self, align_corners: bool) -> Self
Set align_corners.
Sourcepub fn with_output_size(self, output_size: [usize; 2]) -> Self
pub fn with_output_size(self, output_size: [usize; 2]) -> Self
Set the output size [height, width], clearing any scale factor.
Sourcepub fn with_scale_factor(self, scale_factor: [f32; 2]) -> Self
pub fn with_scale_factor(self, scale_factor: [f32; 2]) -> Self
Set the scale factor [scale_height, scale_width], clearing any output size.