Resize
Description
Adjusts the size of the input tensor based on scales.

Input
- ONNX Opset v10
- x: input tensor of type uint8, int8, int16, int32, int64, float16, float, or double.
- scales: array with the same dimension as input x.
- When the ONNX version is Opset v11/v12/v14/v15/v16/v17:
- x: input tensor of type float16 or float.
- sizes: size of the output tensor.
Output
y: output tensor after size adjustment. Its size is determined by the input parameter scales.
Attribute
- ONNX Opset v10
- mode: string, interpolation algorithm whose value is nearest (default) or linear.
- When the ONNX version is Opset v11/v12/v14/v15/v16/v17:
- coordinate_transformation_mode: string, coordinate conversion between the resized image and the original image. The value can be align_corners, asymmetric, tf_half_pixel_for_nn, tf_crop_and_resize, pytorch_half_pixel or half_pixel. The default value is half_pixel.
- cubic_coeff_a: A float, specifying the cubic interpolation coefficient. Defaults to -0.75.
- exclude_outside: int, specifying the weight outside the tensor. Defaults to 0.
- mode: string, interpolation algorithm. The value can be nearest, linear, or cubic. The default value is nearest.
Constraints
- Currently, only the nearest and linear interpolation modes are supported to process images. In addition, you need to modify the model to change the input scales or sizes from placeholder to const. You can use onnxsimplifier to simplify the model.
- When mode is set to nearest, only round_prefer_ceil can be used. Other methods such as round_prefer_floor are not supported.
- When the input is 5-dimensional:
- Currently, only the linear interpolation mode is supported, that is, mode=linear. mode=nearest and mode=cubic are not supported.
- In linear interpolation mode, only the coordinate_transformation_mode=align_corners and pytorch_half_pixel coordinate modes are supported.
ONNX Opset Support
Opset v10/v11/v12/v14/v15/v16/v17/v18
Parent topic: Supported ONNX Operators