# Upsample#

## Upsample - 10#

Version

• name: Upsample (GitHub)

• domain: main

• since_version: 10

• function: False

• support_level: SupportType.COMMON

• shape inference: True

This version of the operator has been deprecated since version 10.

Summary

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

output_dimension = floor(input_dimension * scale).

Attributes

• mode: Two interpolation modes: nearest (default), and linear (including bilinear, trilinear, etc) Default value is `'nearest'`.

Inputs

• X (heterogeneous) - T: N-D tensor

• scales (heterogeneous) - tensor(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’.

Outputs

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

Type Constraints

• T in ( 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) ): Constrain input ‘X’ and output ‘Y’ to all tensor types.

Examples

_nearest

```node = onnx.helper.make_node(
"Upsample",
inputs=["X", "scales"],
outputs=["Y"],
mode="nearest",
)

data = np.array(
[
[
[
[1, 2],
[3, 4],
]
]
],
dtype=np.float32,
)

scales = np.array([1.0, 1.0, 2.0, 3.0], dtype=np.float32)

output = np.array(
[
[
[
[1, 1, 1, 2, 2, 2],
[1, 1, 1, 2, 2, 2],
[3, 3, 3, 4, 4, 4],
[3, 3, 3, 4, 4, 4],
]
]
],
dtype=np.float32,
)

expect(
node,
inputs=[data, scales],
outputs=[output],
name="test_upsample_nearest",
opset_imports=[helper.make_opsetid("", 9)],
)
```

Differences

 `0` `0` `Upsample the input tensor.` `Upsample the input tensor.` `1` `1` `Each dimension value of the output tensor is:` `Each dimension value of the output tensor is:` `2` `2` ` output_dimension = floor(input_dimension * scale).` ` output_dimension = floor(input_dimension * scale).` `3` `3` `4` `4` `**Attributes**` `**Attributes**` `5` `5` `6` `6` `* **mode**:` `* **mode**:` `7` `7` ` Two interpolation modes: nearest (default), and linear (including` ` Two interpolation modes: nearest (default), and linear (including` `8` `8` ` bilinear, trilinear, etc) Default value is 'nearest'.` ` bilinear, trilinear, etc) Default value is 'nearest'.` `9` `9` `10` `10` `**Inputs**` `**Inputs**` `11` `11` `12` `12` `* **X** (heterogeneous) - **T**:` `* **X** (heterogeneous) - **T**:` `13` `13` ` N-D tensor` ` N-D tensor` `14` `14` `* **scales** (heterogeneous) - **tensor(float)**:` `* **scales** (heterogeneous) - **tensor(float)**:` `15` `15` ` The scale array along each dimension. It takes value greater than or` ` The scale array along each dimension. It takes value greater than or` `16` `16` ` equal to 1. The number of elements of 'scales' should be the same as` ` equal to 1. The number of elements of 'scales' should be the same as` `17` `17` ` the rank of input 'X'.` ` the rank of input 'X'.` `18` `18` `19` `19` `**Outputs**` `**Outputs**` `20` `20` `21` `21` `* **Y** (heterogeneous) - **T**:` `* **Y** (heterogeneous) - **T**:` `22` `22` ` N-D tensor after resizing` ` N-D tensor after resizing` `23` `23` `24` `24` `**Type Constraints**` `**Type Constraints**` `25` `25` `26` `26` `* **T** in (` `* **T** in (` `27` `27` ` tensor(bool),` ` tensor(bool),` `28` `28` ` tensor(complex128),` ` tensor(complex128),` `29` `29` ` tensor(complex64),` ` tensor(complex64),` `30` `30` ` tensor(double),` ` tensor(double),` `31` `31` ` tensor(float),` ` tensor(float),` `32` `32` ` tensor(float16),` ` tensor(float16),` `33` `33` ` tensor(int16),` ` tensor(int16),` `34` `34` ` tensor(int32),` ` tensor(int32),` `35` `35` ` tensor(int64),` ` tensor(int64),` `36` `36` ` tensor(int8),` ` tensor(int8),` `37` `37` ` tensor(string),` ` tensor(string),` `38` `38` ` tensor(uint16),` ` tensor(uint16),` `39` `39` ` tensor(uint32),` ` tensor(uint32),` `40` `40` ` tensor(uint64),` ` tensor(uint64),` `41` `41` ` tensor(uint8)` ` tensor(uint8)` `42` `42` ` ):` ` ):` `43` `43` ` Constrain input 'X' and output 'Y' to all tensor types.` ` Constrain input 'X' and output 'Y' to all tensor types.`

## Upsample - 9#

Version

• name: Upsample (GitHub)

• domain: main

• since_version: 9

• function: False

• support_level: SupportType.COMMON

• shape inference: True

This version of the operator has been available since version 9.

Summary

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

output_dimension = floor(input_dimension * scale).

Attributes

• mode: Two interpolation modes: nearest (default), and linear (including bilinear, trilinear, etc) Default value is `'nearest'`.

Inputs

• X (heterogeneous) - T: N-D tensor

• scales (heterogeneous) - tensor(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’.

Outputs

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

Type Constraints

• T in ( 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) ): Constrain input ‘X’ and output ‘Y’ to all tensor types.

Differences

 `0` `0` `Upsample the input tensor.` `Upsample the input tensor.` `1` `1` `Each dimension value of the output tensor is:` `Each dimension value of the output tensor is:` `2` `2` ` output_dimension = floor(input_dimension * scale).` ` output_dimension = floor(input_dimension * scale).` `3` `3` `4` `4` `**Attributes**` `**Attributes**` `5` `5` `6` `6` `* **mode**:` `* **mode**:` `7` `7` ` Two interpolation modes: nearest (default), and linear (including` ` Two interpolation modes: nearest (default), and linear (including` `8` `8` ` bilinear, trilinear, etc) Default value is 'nearest'.` ` bilinear, trilinear, etc) Default value is 'nearest'.` `9` `10` `**Inputs**` `11` `12` `* **X** (heterogeneous) - **T**:` `9` `13` `* **scales** (required):` ` N-D tensor` `14` `* **scales** (heterogeneous) - **tensor(float)**:` `10` `15` ` The scale array along each dimension. It takes value greater than or` ` The scale array along each dimension. It takes value greater than or` `11` `16` ` equal to 1. The number of elements of 'scales' should be the same as` ` equal to 1. The number of elements of 'scales' should be the same as` `12` `17` ` the rank of input 'X'.` ` the rank of input 'X'.` `13` `18` `14` `**Inputs**` `15` `16` `* **X** (heterogeneous) - **T**:` `17` ` N-D tensor` `18` `19` `19` `**Outputs**` `**Outputs**` `20` `20` `21` `21` `* **Y** (heterogeneous) - **T**:` `* **Y** (heterogeneous) - **T**:` `22` `22` ` N-D tensor after resizing` ` N-D tensor after resizing` `23` `23` `24` `24` `**Type Constraints**` `**Type Constraints**` `25` `25` `26` `26` `* **T** in (` `* **T** in (` `27` `27` ` tensor(bool),` ` tensor(bool),` `28` `28` ` tensor(complex128),` ` tensor(complex128),` `29` `29` ` tensor(complex64),` ` tensor(complex64),` `30` `30` ` tensor(double),` ` tensor(double),` `31` `31` ` tensor(float),` ` tensor(float),` `32` `32` ` tensor(float16),` ` tensor(float16),` `33` `33` ` tensor(int16),` ` tensor(int16),` `34` `34` ` tensor(int32),` ` tensor(int32),` `35` `35` ` tensor(int64),` ` tensor(int64),` `36` `36` ` tensor(int8),` ` tensor(int8),` `37` `37` ` tensor(string),` ` tensor(string),` `38` `38` ` tensor(uint16),` ` tensor(uint16),` `39` `39` ` tensor(uint32),` ` tensor(uint32),` `40` `40` ` tensor(uint64),` ` tensor(uint64),` `41` `41` ` tensor(uint8)` ` tensor(uint8)` `42` `42` ` ):` ` ):` `43` `43` ` Constrain input and output types to all tensor types.` ` Constrain input 'X' and output 'Y' to all tensor types.`

## Upsample - 7#

Version

• name: Upsample (GitHub)

• domain: main

• since_version: 7

• function: False

• support_level: SupportType.COMMON

• shape inference: True

This version of the operator has been available since version 7.

Summary

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

output_dimension = floor(input_dimension * scale).

Attributes

• mode: Two interpolation modes: nearest (default), and linear (including bilinear, trilinear, etc) Default value is `'nearest'`.

• scales (required): 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’.

Inputs

• X (heterogeneous) - T: N-D tensor

Outputs

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

Type Constraints

• T in ( 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) ): Constrain input and output types to all tensor types.

Differences

 `0` `0` `Upsample the input tensor.` `Upsample the input tensor.` `1` `1` `The width and height of the output tensor are:` `Each dimension value of the output tensor is:` `2` ` output_width = floor(input_width * width_scale),` `3` `2` ` output_height = floor(input_height * height_scale).` ` output_dimension = floor(input_dimension * scale).` `4` `Example:` `3` `5` `4` ` Given data tensor, width_scale, height_scale, mode,` `**Attributes**` `5` `6` `6` ` Upsample the input 4-D tensor in nearest mode:` `* **mode**:` `7` ` data = [[[` `8` ` [1, 2],` `9` ` [3, 4]` `10` ` ]]]` `11` ` width_scale = 2` `12` `7` ` height_scale = 2` ` Two interpolation modes: nearest (default), and linear (including` `13` `8` ` mode = "nearest"` ` bilinear, trilinear, etc) Default value is 'nearest'.` `14` ` output = [[[` `15` ` [1, 1, 2, 2],` `16` ` [1, 1, 2, 2],` `17` ` [3, 3, 4, 4],` `18` ` [3, 3, 4, 4]` `19` ` ]]]` `20` `21` `**Attributes**` `22` `23` `9` `* **height_scale** (required):` `* **scales** (required):` `24` `10` ` The scale along height dimension. It takes value greater than or` ` The scale array along each dimension. It takes value greater than or` `25` ` equal to 1.` `26` `* **mode**:` `27` ` Two interpolation modes: nearest(default), bilinear Default value is 'nearest'.` `28` `11` `* **width_scale** (required):` ` equal to 1. The number of elements of 'scales' should be the same as` `29` `12` ` The scale along width dimension. It takes value greater than or` ` the rank of input 'X'.` `30` ` equal to 1.` `31` `13` `32` `14` `**Inputs**` `**Inputs**` `33` `15` `34` `16` `* **X** (heterogeneous) - **T**:` `* **X** (heterogeneous) - **T**:` `35` `17` ` 4-D tensor, [N,C,H,W]` ` N-D tensor` `36` `18` `37` `19` `**Outputs**` `**Outputs**` `38` `20` `39` `21` `* **Y** (heterogeneous) - **T**:` `* **Y** (heterogeneous) - **T**:` `40` `22` ` 4-D tensor after resizing, [N,C,H,W]` ` N-D tensor after resizing` `41` `23` `42` `24` `**Type Constraints**` `**Type Constraints**` `43` `25` `44` `26` `* **T** in (` `* **T** in (` `45` `27` ` tensor(bool),` ` tensor(bool),` `28` ` tensor(complex128),` `29` ` tensor(complex64),` `46` `30` ` tensor(double),` ` tensor(double),` `47` `31` ` tensor(float),` ` tensor(float),` `48` `32` ` tensor(float16),` ` tensor(float16),` `33` ` tensor(int16),` `49` `34` ` tensor(int32),` ` tensor(int32),` `50` `35` ` tensor(int64)` ` tensor(int64),` `51` ` ):` `36` ` tensor(int8),` `52` `37` ` Constrain output types to bool, int32, int64, float16, float, double` ` tensor(string),` `38` ` tensor(uint16),` `39` ` tensor(uint32),` `40` ` tensor(uint64),` `53` `41` ` tensors.` ` tensor(uint8)` `42` ` ):` `43` ` Constrain input and output types to all tensor types.`

## Upsample - 1#

Version

• name: Upsample (GitHub)

• domain: main

• since_version: 1

• function: False

• support_level: SupportType.EXPERIMENTAL

• shape inference: False

No versioning maintained for experimental ops.

Summary

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]

]]]

Attributes

• height_scale (required): The scale along height dimension. It takes value greater than or equal to 1.

• mode: Two interpolation modes: nearest(default), bilinear Default value is `'nearest'`.

• width_scale (required): The scale along width dimension. It takes value greater than or equal to 1.

Inputs

• X (heterogeneous) - T: 4-D tensor, [N,C,H,W]

Outputs

• Y (heterogeneous) - T: 4-D tensor after resizing, [N,C,H,W]

Type Constraints

• T in ( tensor(bool), tensor(double), tensor(float), tensor(float16), tensor(int32), tensor(int64) ): Constrain output types to bool, int32, int64, float16, float, double tensors.