Upsample - version 7#

This page documents version 7 of operator Upsample. See Upsample for the latest version (since version 10).

  • Domain: ai.onnx

  • Since version: 7

Upsample the input tensor. Each dimension value of the output tensor is:

output_dimension = floor(input_dimension * scale).

Inputs

  • X (T): N-D tensor

Outputs

  • Y (T): N-D tensor after resizing

Attributes

  • mode (string): Two interpolation modes: nearest (default), and linear (including bilinear, trilinear, etc)

  • scales (float[]): The scale array along each dimension. It takes value greater than or equal to 1. The number of elements of ‘scales’ should be the same as the rank of input ‘X’.

Type Constraints

  • T: Constrain input and output types to all tensor types. Allowed types: tensor(bool), tensor(complex128), tensor(complex64), tensor(double), tensor(float), tensor(float16), tensor(int16), tensor(int32), tensor(int64), tensor(int8), tensor(string), tensor(uint16), tensor(uint32), tensor(uint64), tensor(uint8).

Differences with previous version (1)#

SchemaDiff: Upsample (domain 'ai.onnx')

  • old version: 1

  • new version: 7

  • breaking: yes

Breaking reasons:

  • attribute ‘width_scale’ (removed): type=FLOAT; required=True

  • attribute ‘height_scale’ (removed): type=FLOAT; required=True

  • attribute ‘scales’ (added): type=FLOATS; required=True

Attributes:

  • [BREAKING] removed ‘width_scale’: type=FLOAT; required=True

  • [BREAKING] removed ‘height_scale’: type=FLOAT; required=True

  • [BREAKING] added ‘scales’: type=FLOATS; required=True

Type constraints:

  • changed ‘T’: added types: [‘tensor(complex128)’, ‘tensor(complex64)’, ‘tensor(int16)’, ‘tensor(int8)’, ‘tensor(string)’, ‘tensor(uint16)’, ‘tensor(uint32)’, ‘tensor(uint64)’, ‘tensor(uint8)’]

Documentation:

  • line similarity: 0.16 (+2/-19 lines)

--- Upsample v1
+++ Upsample v7
@@ -1,21 +1,4 @@

 Upsample the input tensor.
-The width and height of the output tensor are:
-  output_width = floor(input_width * width_scale),
-  output_height = floor(input_height * height_scale).
-Example:
-  Given `data` tensor, width_scale, height_scale, mode,
-  Upsample the input 4-D tensor in nearest mode:
-  data = [[[
-      [1, 2],
-      [3, 4]
-  ]]]
-  width_scale = 2
-  height_scale = 2
-  mode = "nearest"
-  output = [[[
-      [1, 1, 2, 2],
-      [1, 1, 2, 2],
-      [3, 3, 4, 4],
-      [3, 3, 4, 4]
-  ]]]
+Each dimension value of the output tensor is:
+  output_dimension = floor(input_dimension * scale).