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

00Upsample the input tensor.Upsample the input tensor.
11Each dimension value of the output tensor is:Each dimension value of the output tensor is:
22 output_dimension = floor(input_dimension * scale). output_dimension = floor(input_dimension * scale).
33
44**Attributes****Attributes**
55
66* **mode**:* **mode**:
77 Two interpolation modes: nearest (default), and linear (including Two interpolation modes: nearest (default), and linear (including
88 bilinear, trilinear, etc) Default value is 'nearest'. bilinear, trilinear, etc) Default value is 'nearest'.
99
1010**Inputs****Inputs**
1111
1212* **X** (heterogeneous) - **T**:* **X** (heterogeneous) - **T**:
1313 N-D tensor N-D tensor
1414* **scales** (heterogeneous) - **tensor(float)**:* **scales** (heterogeneous) - **tensor(float)**:
1515 The scale array along each dimension. It takes value greater than or The scale array along each dimension. It takes value greater than or
1616 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
1717 the rank of input 'X'. the rank of input 'X'.
1818
1919**Outputs****Outputs**
2020
2121* **Y** (heterogeneous) - **T**:* **Y** (heterogeneous) - **T**:
2222 N-D tensor after resizing N-D tensor after resizing
2323
2424**Type Constraints****Type Constraints**
2525
2626* **T** in (* **T** in (
2727 tensor(bool), tensor(bool),
2828 tensor(complex128), tensor(complex128),
2929 tensor(complex64), tensor(complex64),
3030 tensor(double), tensor(double),
3131 tensor(float), tensor(float),
3232 tensor(float16), tensor(float16),
3333 tensor(int16), tensor(int16),
3434 tensor(int32), tensor(int32),
3535 tensor(int64), tensor(int64),
3636 tensor(int8), tensor(int8),
3737 tensor(string), tensor(string),
3838 tensor(uint16), tensor(uint16),
3939 tensor(uint32), tensor(uint32),
4040 tensor(uint64), tensor(uint64),
4141 tensor(uint8) tensor(uint8)
4242 ): ):
4343 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

00Upsample the input tensor.Upsample the input tensor.
11Each dimension value of the output tensor is:Each dimension value of the output tensor is:
22 output_dimension = floor(input_dimension * scale). output_dimension = floor(input_dimension * scale).
33
44**Attributes****Attributes**
55
66* **mode**:* **mode**:
77 Two interpolation modes: nearest (default), and linear (including Two interpolation modes: nearest (default), and linear (including
88 bilinear, trilinear, etc) Default value is 'nearest'. bilinear, trilinear, etc) Default value is 'nearest'.
9
10**Inputs**
11
12* **X** (heterogeneous) - **T**:
913* **scales** (required): N-D tensor
14* **scales** (heterogeneous) - **tensor(float)**:
1015 The scale array along each dimension. It takes value greater than or The scale array along each dimension. It takes value greater than or
1116 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
1217 the rank of input 'X'. the rank of input 'X'.
1318
14**Inputs**
15
16* **X** (heterogeneous) - **T**:
17 N-D tensor
18
1919**Outputs****Outputs**
2020
2121* **Y** (heterogeneous) - **T**:* **Y** (heterogeneous) - **T**:
2222 N-D tensor after resizing N-D tensor after resizing
2323
2424**Type Constraints****Type Constraints**
2525
2626* **T** in (* **T** in (
2727 tensor(bool), tensor(bool),
2828 tensor(complex128), tensor(complex128),
2929 tensor(complex64), tensor(complex64),
3030 tensor(double), tensor(double),
3131 tensor(float), tensor(float),
3232 tensor(float16), tensor(float16),
3333 tensor(int16), tensor(int16),
3434 tensor(int32), tensor(int32),
3535 tensor(int64), tensor(int64),
3636 tensor(int8), tensor(int8),
3737 tensor(string), tensor(string),
3838 tensor(uint16), tensor(uint16),
3939 tensor(uint32), tensor(uint32),
4040 tensor(uint64), tensor(uint64),
4141 tensor(uint8) tensor(uint8)
4242 ): ):
4343 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

00Upsample the input tensor.Upsample the input tensor.
11The width and height of the output tensor are:Each dimension value of the output tensor is:
2 output_width = floor(input_width * width_scale),
32 output_height = floor(input_height * height_scale). output_dimension = floor(input_dimension * scale).
4Example:
3
54 Given data tensor, width_scale, height_scale, mode,**Attributes**
5
66 Upsample the input 4-D tensor in nearest mode:* **mode**:
7 data = [[[
8 [1, 2],
9 [3, 4]
10 ]]]
11 width_scale = 2
127 height_scale = 2 Two interpolation modes: nearest (default), and linear (including
138 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
239* **height_scale** (required):* **scales** (required):
2410 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'.
2811* **width_scale** (required): equal to 1. The number of elements of 'scales' should be the same as
2912 The scale along width dimension. It takes value greater than or the rank of input 'X'.
30 equal to 1.
3113
3214**Inputs****Inputs**
3315
3416* **X** (heterogeneous) - **T**:* **X** (heterogeneous) - **T**:
3517 4-D tensor, [N,C,H,W] N-D tensor
3618
3719**Outputs****Outputs**
3820
3921* **Y** (heterogeneous) - **T**:* **Y** (heterogeneous) - **T**:
4022 4-D tensor after resizing, [N,C,H,W] N-D tensor after resizing
4123
4224**Type Constraints****Type Constraints**
4325
4426* **T** in (* **T** in (
4527 tensor(bool), tensor(bool),
28 tensor(complex128),
29 tensor(complex64),
4630 tensor(double), tensor(double),
4731 tensor(float), tensor(float),
4832 tensor(float16), tensor(float16),
33 tensor(int16),
4934 tensor(int32), tensor(int32),
5035 tensor(int64) tensor(int64),
51 ):
36 tensor(int8),
5237 Constrain output types to bool, int32, int64, float16, float, double tensor(string),
38 tensor(uint16),
39 tensor(uint32),
40 tensor(uint64),
5341 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.