com.ms.internal.nhwc - MaxUnpool#

MaxUnpool - 9#

Version

  • name: MaxUnpool (GitHub)

  • domain: com.ms.internal.nhwc

  • since_version: 9

  • function:

  • support_level: SupportType.COMMON

  • shape inference: True

This version of the operator has been available since version 9 of domain com.ms.internal.nhwc.

Summary

Attributes

  • activation - STRING :

  • activation_params - FLOATS :

  • kernel_shape - INTS (required) : The size of the kernel along each axis.

  • pads - INTS : Padding for the beginning and ending along each spatial axis, it can take any value greater than or equal to 0. The value represent the number of pixels added to the beginning and end part of the corresponding axis. pads format should be as follow [x1_begin, x2_begin…x1_end, x2_end,…], where xi_begin the number of pixels added at the beginning of axis i and xi_end, the number of pixels added at the end of axis i. This attribute cannot be used simultaneously with auto_pad attribute. If not present, the padding defaults to 0 along start and end of each spatial axis.

  • strides - INTS : Stride along each spatial axis.

Inputs

Between 2 and 3 inputs.

  • X (heterogeneous) - T1:

  • I (heterogeneous) - T2:

  • output_shape (optional, heterogeneous) - T2:

Outputs

  • output (heterogeneous) - T1:

Type Constraints

  • T1 in ( tensor(double), tensor(float), tensor(float16) ): Constrain input and output types to float tensors.

  • T2 in ( tensor(int64) ): Constrain index tensor to int64

Examples

_without_output_shape

import numpy as np
import onnx

node = onnx.helper.make_node(
    "MaxUnpool",
    inputs=["xT", "xI"],
    outputs=["y"],
    kernel_shape=[2, 2],
    strides=[2, 2],
)
xT = np.array([[[[1, 2], [3, 4]]]], dtype=np.float32)
xI = np.array([[[[5, 7], [13, 15]]]], dtype=np.int64)
y = np.array(
    [[[[0, 0, 0, 0], [0, 1, 0, 2], [0, 0, 0, 0], [0, 3, 0, 4]]]],
    dtype=np.float32,
)
expect(
    node,
    inputs=[xT, xI],
    outputs=[y],
    name="test_maxunpool_export_without_output_shape",
)

_with_output_shape

import numpy as np
import onnx

node = onnx.helper.make_node(
    "MaxUnpool",
    inputs=["xT", "xI", "output_shape"],
    outputs=["y"],
    kernel_shape=[2, 2],
    strides=[2, 2],
)
xT = np.array([[[[5, 6], [7, 8]]]], dtype=np.float32)
xI = np.array([[[[5, 7], [13, 15]]]], dtype=np.int64)
output_shape = np.array((1, 1, 5, 5), dtype=np.int64)
y = np.array(
    [
        [
            [
                [0, 0, 0, 0, 0],
                [0, 5, 0, 6, 0],
                [0, 0, 0, 0, 0],
                [0, 7, 0, 8, 0],
                [0, 0, 0, 0, 0],
            ]
        ]
    ],
    dtype=np.float32,
)
expect(
    node,
    inputs=[xT, xI, output_shape],
    outputs=[y],
    name="test_maxunpool_export_with_output_shape",
)