pub struct Interpolate2dConfig {
pub output_size: Option<[usize; 2]>,
pub scale_factor: Option<[f32; 2]>,
pub mode: InterpolateMode,
pub align_corners: bool,
}Expand description
Configuration for the 2D interpolation module.
This struct defines the configuration options for the 2D interpolation operation. It allows specifying the output size, scale factor, and interpolation mode.
Fields§
§output_size: Option<[usize; 2]>Output size of the interpolated tensor.
If specified, this takes precedence over scale_factor.
scale_factor: Option<[f32; 2]>Scale factor for resizing the input tensor.
This is used when output_size is not specified.
mode: InterpolateModeInterpolation mode to use for resizing. Determines how the output values are calculated.
align_corners: boolIf true, the input and output tensors are aligned by their corner pixels.
If false, half-pixel coordinate mapping is used instead.
Implementations§
Source§impl Interpolate2dConfig
impl Interpolate2dConfig
Sourcepub fn new() -> Interpolate2dConfig
pub fn new() -> Interpolate2dConfig
Create a new instance of the config.
§Arguments
§Default Arguments
§output_size
Output size of the interpolated tensor.
If specified, this takes precedence over scale_factor.
- Defaults to
"None"
§scale_factor
Scale factor for resizing the input tensor.
This is used when output_size is not specified.
- Defaults to
"None"
§mode
Interpolation mode to use for resizing. Determines how the output values are calculated.
- Defaults to
"InterpolateMode::Nearest"
§align_corners
If true, the input and output tensors are aligned by their corner pixels.
If false, half-pixel coordinate mapping is used instead.
- Defaults to
true
Source§impl Interpolate2dConfig
impl Interpolate2dConfig
Sourcepub fn with_output_size(
self,
output_size: Option<[usize; 2]>,
) -> Interpolate2dConfig
pub fn with_output_size( self, output_size: Option<[usize; 2]>, ) -> Interpolate2dConfig
Sets the value for the field output_size.
Output size of the interpolated tensor.
If specified, this takes precedence over scale_factor.
- Defaults to
"None"
Sourcepub fn with_scale_factor(
self,
scale_factor: Option<[f32; 2]>,
) -> Interpolate2dConfig
pub fn with_scale_factor( self, scale_factor: Option<[f32; 2]>, ) -> Interpolate2dConfig
Sets the value for the field scale_factor.
Scale factor for resizing the input tensor.
This is used when output_size is not specified.
- Defaults to
"None"
Sourcepub fn with_mode(self, mode: InterpolateMode) -> Interpolate2dConfig
pub fn with_mode(self, mode: InterpolateMode) -> Interpolate2dConfig
Sets the value for the field mode.
Interpolation mode to use for resizing. Determines how the output values are calculated.
- Defaults to
"InterpolateMode::Nearest"
Sourcepub fn with_align_corners(self, align_corners: bool) -> Interpolate2dConfig
pub fn with_align_corners(self, align_corners: bool) -> Interpolate2dConfig
Sets the value for the field align_corners.
If true, the input and output tensors are aligned by their corner pixels.
If false, half-pixel coordinate mapping is used instead.
- Defaults to
true
Source§impl Interpolate2dConfig
impl Interpolate2dConfig
Sourcepub fn init(self) -> Interpolate2d
pub fn init(self) -> Interpolate2d
Initialize the interpolation module
Trait Implementations§
Source§impl Clone for Interpolate2dConfig
impl Clone for Interpolate2dConfig
Source§fn clone(&self) -> Interpolate2dConfig
fn clone(&self) -> Interpolate2dConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more