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)

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

import numpy as np
import onnx

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)],
)

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)

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.

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)

  • 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.

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

  • 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.