Skip to main content

interpolate

Function interpolate 

Source
pub fn interpolate(x: Tensor<4>, options: InterpolateOptions) -> Tensor<4>
Expand description

Applies a 2D interpolation.

The output spatial size is taken from options.output_size, or computed as floor(input_size * scale_factor) from options.scale_factor.

§Panics

Panics unless exactly one of output_size or scale_factor is set, or if the scaled size exceeds usize::MAX.

§Example

ⓘ
// Resize to a fixed size.
interpolate(x, InterpolateOptions::new(mode).with_output_size([224, 224]));
// Upsample by 2x.
interpolate(x, InterpolateOptions::new(mode).with_scale_factor([2.0, 2.0]));