示例#1
0
    def export_no_keepdims():  # type: () -> None
        data = np.array([[2, 1], [3, 10]], dtype=np.float32)
        axis = 1
        keepdims = 0
        node = onnx.helper.make_node('ArgMax',
                                     inputs=['data'],
                                     outputs=['result'],
                                     axis=axis,
                                     keepdims=keepdims)
        # result: [[0, 1]]
        result = argmax_use_numpy(data, axis=axis, keepdims=keepdims)
        expect(
            node,
            inputs=[data],
            outputs=[result],
            name='test_argmax_no_keepdims_example',
        )

        data = np.random.uniform(-10, 10, [2, 3, 4]).astype(np.float32)
        # result's shape: [2, 4]
        result = argmax_use_numpy(data, axis=axis, keepdims=keepdims)
        expect(node,
               inputs=[data],
               outputs=[result],
               name='test_argmax_no_keepdims_random')
示例#2
0
    def export():  # type: () -> None
        original_shape = [2, 3, 4]
        test_cases = {
            'reordered_all_dims': np.array([4, 2, 3], dtype=np.int64),
            'reordered_last_dims': np.array([2, 4, 3], dtype=np.int64),
            'reduced_dims': np.array([2, 12], dtype=np.int64),
            'extended_dims': np.array([2, 3, 2, 2], dtype=np.int64),
            'one_dim': np.array([24], dtype=np.int64),
            'negative_dim': np.array([2, -1, 2], dtype=np.int64),
            'negative_extended_dims': np.array([-1, 2, 3, 4], dtype=np.int64),
            'zero_dim': np.array([2, 0, 4, 1], dtype=np.int64),
            'zero_and_negative_dim': np.array([2, 0, 1, -1], dtype=np.int64),
        }
        data = np.random.random_sample(original_shape).astype(np.float32)

        for test_name, shape in test_cases.items():
            node = onnx.helper.make_node(
                'Reshape',
                inputs=['data', 'shape'],
                outputs=['reshaped'],
            )

            reshaped = reshape_reference_implementation(data, shape)

            expect(
                node,
                inputs=[data, shape],
                outputs=[reshaped],
                name='test_reshape_' + test_name,
            )
示例#3
0
    def export_conv_with_autopad_same():  # type: () -> None

        x = np.array([[[
            [0.0, 1.0, 2.0, 3.0, 4.0],  # (1, 1, 5, 5) input tensor
            [5.0, 6.0, 7.0, 8.0, 9.0],
            [10.0, 11.0, 12.0, 13.0, 14.0],
            [15.0, 16.0, 17.0, 18.0, 19.0],
            [20.0, 21.0, 22.0, 23.0, 24.0],
        ]]]).astype(np.float32)
        W = np.array([[[
            [1.0, 1.0, 1.0],  # (1, 1, 3, 3) tensor for convolution weights
            [1.0, 1.0, 1.0],
            [1.0, 1.0, 1.0],
        ]]]).astype(np.float32)

        # Convolution with auto_pad='SAME_LOWER' and strides=2
        node = onnx.helper.make_node(
            'Conv',
            inputs=['x', 'W'],
            outputs=['y'],
            auto_pad='SAME_LOWER',
            kernel_shape=[3, 3],
            strides=[2, 2],
        )
        y = np.array([[[[12.0, 27.0, 24.0], [63.0, 108.0, 81.0],
                        [72.0, 117.0, 84.0]]]]).astype(np.float32)
        expect(node,
               inputs=[x, W],
               outputs=[y],
               name='test_conv_with_autopad_same')
示例#4
0
    def export():  # type: () -> None
        node = onnx.helper.make_node(
            'Shape',
            inputs=['x'],
            outputs=['y'],
        )

        x = np.array(
            [
                [1, 2, 3],
                [4, 5, 6],
            ]
        ).astype(np.float32)
        y = np.array(
            [
                2,
                3,
            ]
        ).astype(np.int64)

        expect(node, inputs=[x], outputs=[y], name='test_shape_example')

        x = np.random.randn(3, 4, 5).astype(np.float32)
        y = np.array(x.shape).astype(np.int64)

        expect(node, inputs=[x], outputs=[y], name='test_shape')
示例#5
0
    def export_negative_axis_keepdims_select_last_index():  # type: () -> None
        data = np.array([[2, 2], [3, 10]], dtype=np.float32)
        axis = -1
        keepdims = 1
        node = onnx.helper.make_node(
            'ArgMin',
            inputs=['data'],
            outputs=['result'],
            axis=axis,
            keepdims=keepdims,
            select_last_index=True,
        )
        # result: [[1], [0]]
        result = argmin_use_numpy_select_last_index(data,
                                                    axis=axis,
                                                    keepdims=keepdims)
        expect(
            node,
            inputs=[data],
            outputs=[result],
            name='test_argmin_negative_axis_keepdims_example_select_last_index',
        )

        data = np.random.uniform(-10, 10, [2, 3, 4]).astype(np.float32)
        # result's shape: [2, 3, 1]
        result = argmin_use_numpy_select_last_index(data,
                                                    axis=axis,
                                                    keepdims=keepdims)
        expect(
            node,
            inputs=[data],
            outputs=[result],
            name='test_argmin_negative_axis_keepdims_random_select_last_index',
        )
示例#6
0
    def export_averagepool_3d_default():  # type: () -> None
        """
        input_shape: [1, 3, 32, 32, 32]
        output_shape: [1, 3, 31, 31, 31]
        """
        node = onnx.helper.make_node(
            'AveragePool',
            inputs=['x'],
            outputs=['y'],
            kernel_shape=[2, 2, 2],
        )
        x = np.random.randn(1, 3, 32, 32, 32).astype(np.float32)
        x_shape = np.shape(x)
        kernel_shape = [2, 2, 2]
        strides = [1, 1, 1]
        out_shape = get_output_shape('VALID', x_shape[2:], kernel_shape,
                                     strides)
        padded = x
        y = pool(padded, x_shape, kernel_shape, strides, out_shape, [0, 0, 0],
                 'AVG')

        expect(node,
               inputs=[x],
               outputs=[y],
               name='test_averagepool_3d_default')
示例#7
0
    def export_averagepool_2d_strides():  # type: () -> None
        """
        input_shape: [1, 3, 32, 32]
        output_shape: [1, 3, 10, 10]
        """
        node = onnx.helper.make_node(
            'AveragePool',
            inputs=['x'],
            outputs=['y'],
            kernel_shape=[5, 5],
            strides=[3, 3],
        )
        x = np.random.randn(1, 3, 32, 32).astype(np.float32)
        x_shape = np.shape(x)
        kernel_shape = (5, 5)
        strides = (3, 3)
        out_shape = get_output_shape('VALID', x_shape[2:], kernel_shape,
                                     strides)
        padded = x
        y = pool(padded, x_shape, kernel_shape, strides, out_shape, (0, 0),
                 'AVG')

        expect(node,
               inputs=[x],
               outputs=[y],
               name='test_averagepool_2d_strides')
示例#8
0
    def export_averagepool_2d_precomputed_strides():  # type: () -> None
        """
        input_shape: [1, 1, 5, 5]
        output_shape: [1, 1, 2, 2]
        """
        node = onnx.helper.make_node(
            'AveragePool',
            inputs=['x'],
            outputs=['y'],
            kernel_shape=[2, 2],
            strides=[2, 2],
        )
        x = np.array([[[
            [1, 2, 3, 4, 5],
            [6, 7, 8, 9, 10],
            [11, 12, 13, 14, 15],
            [16, 17, 18, 19, 20],
            [21, 22, 23, 24, 25],
        ]]]).astype(np.float32)
        y = np.array([[[[4, 6], [14, 16]]]]).astype(np.float32)

        expect(
            node,
            inputs=[x],
            outputs=[y],
            name='test_averagepool_2d_precomputed_strides',
        )
示例#9
0
    def export_sequence():  # type: () -> None
        node = onnx.helper.make_node(
            'Identity',
            inputs=['x'],
            outputs=['y'],
        )

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

        expect(node,
               inputs=[data],
               outputs=[data],
               name='test_identity_sequence')
示例#10
0
    def export_averagepool_2d_pads():  # type: () -> None
        """
        input_shape: [1, 3, 28, 28]
        output_shape: [1, 3, 30, 30]
        pad_shape: [4, 4] -> [2, 2, 2, 2] by axis
        """
        node = onnx.helper.make_node(
            'AveragePool',
            inputs=['x'],
            outputs=['y'],
            kernel_shape=[3, 3],
            pads=[2, 2, 2, 2],
        )
        x = np.random.randn(1, 3, 28, 28).astype(np.float32)
        x_shape = np.shape(x)
        kernel_shape = (3, 3)
        strides = (1, 1)
        pad_bottom = 2
        pad_top = 2
        pad_right = 2
        pad_left = 2
        pad_shape = [pad_top + pad_bottom, pad_left + pad_right]
        out_shape = get_output_shape('VALID', np.add(x_shape[2:], pad_shape),
                                     kernel_shape, strides)
        padded = np.pad(
            x,
            ((0, 0), (0, 0), (pad_top, pad_bottom), (pad_left, pad_right)),
            mode='constant',
            constant_values=np.nan,
        )
        y = pool(padded, x_shape, kernel_shape, strides, out_shape, pad_shape,
                 'AVG')

        expect(node, inputs=[x], outputs=[y], name='test_averagepool_2d_pads')
示例#11
0
    def export_default_axes_keepdims():  # type: () -> None
        data = np.array([[2, 1], [3, 10]], dtype=np.float32)
        keepdims = 1
        node = onnx.helper.make_node('ArgMin',
                                     inputs=['data'],
                                     outputs=['result'],
                                     keepdims=keepdims)

        # The content of result is : [[0], [0]]
        result = argmin_use_numpy(data, keepdims=keepdims)
        expect(
            node,
            inputs=[data],
            outputs=[result],
            name='test_argmin_default_axis_example',
        )

        data = np.random.uniform(-10, 10, [2, 3, 4]).astype(np.float32)
        # result's shape: [1, 3, 4]
        result = argmin_use_numpy(data, keepdims=keepdims)
        expect(
            node,
            inputs=[data],
            outputs=[result],
            name='test_argmin_default_axis_random',
        )
示例#12
0
    def export_averagepool_2d_precomputed_same_upper():  # type: () -> None
        """
        input_shape: [1, 1, 5, 5]
        output_shape: [1, 1, 3, 3]
        pad_shape: [2, 2] -> [1, 1, 1, 1] by axis
        """
        node = onnx.helper.make_node(
            'AveragePool',
            inputs=['x'],
            outputs=['y'],
            kernel_shape=[3, 3],
            strides=[2, 2],
            auto_pad='SAME_UPPER',
        )
        x = np.array([[[
            [1, 2, 3, 4, 5],
            [6, 7, 8, 9, 10],
            [11, 12, 13, 14, 15],
            [16, 17, 18, 19, 20],
            [21, 22, 23, 24, 25],
        ]]]).astype(np.float32)
        y = np.array([[[[4, 5.5, 7], [11.5, 13, 14.5],
                        [19, 20.5, 22]]]]).astype(np.float32)

        expect(
            node,
            inputs=[x],
            outputs=[y],
            name='test_averagepool_2d_precomputed_same_upper',
        )
示例#13
0
    def export_default_values():  # type: () -> None
        input = np.array([1.0, 2.0, 3.0, 4.0, 5.0, 6.0]).astype(np.float32)

        # If axis is not specified, split is applied on default axis 0
        node = onnx.helper.make_node(
            'Split', inputs=['input'], outputs=['output_1', 'output_2', 'output_3']
        )

        expected_outputs = [
            np.array([1.0, 2.0]).astype(np.float32),
            np.array([3.0, 4.0]).astype(np.float32),
            np.array([5.0, 6.0]).astype(np.float32),
        ]
        expect(
            node,
            inputs=[input],
            outputs=[y for y in expected_outputs],
            name='test_split_equal_parts_default_axis',
        )

        split = np.array([2, 4]).astype(np.int64)
        node = onnx.helper.make_node(
            'Split', inputs=['input', 'split'], outputs=['output_1', 'output_2']
        )

        expected_outputs = [
            np.array([1.0, 2.0]).astype(np.float32),
            np.array([3.0, 4.0, 5.0, 6.0]).astype(np.float32),
        ]
        expect(
            node,
            inputs=[input, split],
            outputs=[y for y in expected_outputs],
            name='test_split_variable_parts_default_axis',
        )
    def export_default_axes_keepdims():  # type: () -> None
        shape = [3, 2, 2]
        axes = None
        keepdims = 1

        node = onnx.helper.make_node(
            'ReduceLogSumExp', inputs=['data'], outputs=['reduced'], keepdims=keepdims
        )

        data = np.array(
            [[[5, 1], [20, 2]], [[30, 1], [40, 2]], [[55, 1], [60, 2]]], dtype=np.double
        )
        reduced = np.log(np.sum(np.exp(data), axis=axes, keepdims=keepdims == 1))
        # print(reduced)
        # [[[60.00671387]]]

        expect(
            node,
            inputs=[data],
            outputs=[reduced],
            name='test_reduce_log_sum_exp_default_axes_keepdims_example',
        )

        np.random.seed(0)
        data = np.random.uniform(-10, 10, shape).astype(np.double)
        reduced = np.log(np.sum(np.exp(data), axis=axes, keepdims=keepdims == 1))
        expect(
            node,
            inputs=[data],
            outputs=[reduced],
            name='test_reduce_log_sum_exp_default_axes_keepdims_random',
        )
示例#15
0
 def export_default_zero_bias():  # type: () -> None
     node = onnx.helper.make_node('Gemm', inputs=['a', 'b', 'c'], outputs=['y'])
     a = np.random.ranf([3, 5]).astype(np.float32)
     b = np.random.ranf([5, 4]).astype(np.float32)
     c = np.zeros([1, 4]).astype(np.float32)
     y = gemm_reference_impl(a, b, c)
     expect(node, inputs=[a, b, c], outputs=[y], name='test_gemm_default_zero_bias')
示例#16
0
    def export_default_axes_keepdims():  # type: () -> None
        shape = [3, 2, 2]
        axes = None
        keepdims = 1

        node = onnx.helper.make_node(
            'ReduceProd', inputs=['data'], outputs=['reduced'], keepdims=keepdims
        )

        data = np.array(
            [[[1, 2], [3, 4]], [[5, 6], [7, 8]], [[9, 10], [11, 12]]], dtype=np.float32
        )
        reduced = np.prod(data, axis=axes, keepdims=keepdims == 1)
        # print(reduced)
        # [[[4.790016e+08]]]

        expect(
            node,
            inputs=[data],
            outputs=[reduced],
            name='test_reduce_prod_default_axes_keepdims_example',
        )

        np.random.seed(0)
        data = np.random.uniform(-10, 10, shape).astype(np.float32)
        reduced = np.prod(data, axis=axes, keepdims=keepdims == 1)
        expect(
            node,
            inputs=[data],
            outputs=[reduced],
            name='test_reduce_prod_default_axes_keepdims_random',
        )
示例#17
0
    def export_default_axes_keepdims():  # type: () -> None
        shape = [3, 2, 2]
        axes = None
        keepdims = 1

        node = onnx.helper.make_node('ReduceMean',
                                     inputs=['data'],
                                     outputs=['reduced'],
                                     keepdims=keepdims)

        data = np.array(
            [[[5, 1], [20, 2]], [[30, 1], [40, 2]], [[55, 1], [60, 2]]],
            dtype=np.float32,
        )
        reduced = np.mean(data, axis=axes, keepdims=keepdims == 1)
        # print(reduced)
        # [[[18.25]]]

        expect(
            node,
            inputs=[data],
            outputs=[reduced],
            name='test_reduce_mean_default_axes_keepdims_example',
        )

        np.random.seed(0)
        data = np.random.uniform(-10, 10, shape).astype(np.float32)
        reduced = np.mean(data, axis=axes, keepdims=keepdims == 1)

        expect(
            node,
            inputs=[data],
            outputs=[reduced],
            name='test_reduce_mean_default_axes_keepdims_random',
        )
示例#18
0
    def export_averagepool_2d_precomputed_pads():  # type: () -> None
        """
        input_shape: [1, 1, 5, 5]
        output_shape: [1, 1, 5, 5]
        pad_shape: [4, 4] -> [2, 2, 2, 2] by axis
        """
        node = onnx.helper.make_node(
            'AveragePool',
            inputs=['x'],
            outputs=['y'],
            kernel_shape=[5, 5],
            pads=[2, 2, 2, 2],
        )
        x = np.array([[[
            [1, 2, 3, 4, 5],
            [6, 7, 8, 9, 10],
            [11, 12, 13, 14, 15],
            [16, 17, 18, 19, 20],
            [21, 22, 23, 24, 25],
        ]]]).astype(np.float32)
        y = np.array([[[
            [7, 7.5, 8, 8.5, 9],
            [9.5, 10, 10.5, 11, 11.5],
            [12, 12.5, 13, 13.5, 14],
            [14.5, 15, 15.5, 16, 16.5],
            [17, 17.5, 18, 18.5, 19],
        ]]]).astype(np.float32)

        expect(node,
               inputs=[x],
               outputs=[y],
               name='test_averagepool_2d_precomputed_pads')
示例#19
0
    def export_nokeepdims():  # type: () -> None
        node = onnx.helper.make_node(
            'ReduceLogSum',
            inputs=['data'],
            outputs=["reduced"],
            axes=[2, 1],
            keepdims=0,
        )
        data = np.random.ranf([3, 4, 5]).astype(np.float32)
        reduced = np.log(np.sum(data, axis=(2, 1), keepdims=False))
        expect(
            node, inputs=[data], outputs=[reduced], name='test_reduce_log_sum_desc_axes'
        )

        node = onnx.helper.make_node(
            'ReduceLogSum',
            inputs=['data'],
            outputs=["reduced"],
            axes=[0, 1],
            keepdims=0,
        )
        data = np.random.ranf([3, 4, 5]).astype(np.float32)
        reduced = np.log(np.sum(data, axis=(0, 1), keepdims=False))
        expect(
            node, inputs=[data], outputs=[reduced], name='test_reduce_log_sum_asc_axes'
        )
示例#20
0
    def export():  # type: () -> None

        x = np.array([[[
            [0.0, 1.0, 2.0, 3.0, 4.0],  # (1, 1, 5, 5) input tensor
            [5.0, 6.0, 7.0, 8.0, 9.0],
            [10.0, 11.0, 12.0, 13.0, 14.0],
            [15.0, 16.0, 17.0, 18.0, 19.0],
            [20.0, 21.0, 22.0, 23.0, 24.0],
        ]]]).astype(np.float32)
        W = np.array([[[
            [1.0, 1.0, 1.0],  # (1, 1, 3, 3) tensor for convolution weights
            [1.0, 1.0, 1.0],
            [1.0, 1.0, 1.0],
        ]]]).astype(np.float32)

        # Convolution with padding
        node_with_padding = onnx.helper.make_node(
            'Conv',
            inputs=['x', 'W'],
            outputs=['y'],
            kernel_shape=[3, 3],
            # Default values for other attributes: strides=[1, 1], dilations=[1, 1], groups=1
            pads=[1, 1, 1, 1],
        )
        y_with_padding = np.array([[[
            [12.0, 21.0, 27.0, 33.0, 24.0],  # (1, 1, 5, 5) output tensor
            [33.0, 54.0, 63.0, 72.0, 51.0],
            [63.0, 99.0, 108.0, 117.0, 81.0],
            [93.0, 144.0, 153.0, 162.0, 111.0],
            [72.0, 111.0, 117.0, 123.0, 84.0],
        ]]]).astype(np.float32)
        expect(
            node_with_padding,
            inputs=[x, W],
            outputs=[y_with_padding],
            name='test_basic_conv_with_padding',
        )

        # Convolution without padding
        node_without_padding = onnx.helper.make_node(
            'Conv',
            inputs=['x', 'W'],
            outputs=['y'],
            kernel_shape=[3, 3],
            # Default values for other attributes: strides=[1, 1], dilations=[1, 1], groups=1
            pads=[0, 0, 0, 0],
        )
        y_without_padding = np.array([[[
            [54.0, 63.0, 72.0],  # (1, 1, 3, 3) output tensor
            [99.0, 108.0, 117.0],
            [144.0, 153.0, 162.0],
        ]]]).astype(np.float32)
        expect(
            node_without_padding,
            inputs=[x, W],
            outputs=[y_without_padding],
            name='test_basic_conv_without_padding',
        )
示例#21
0
 def export_transposeB():  # type: () -> None
     node = onnx.helper.make_node(
         'Gemm', inputs=['a', 'b', 'c'], outputs=['y'], transB=1
     )
     a = np.random.ranf([3, 6]).astype(np.float32)
     b = np.random.ranf([4, 6]).astype(np.float32)
     c = np.zeros([1, 4]).astype(np.float32)
     y = gemm_reference_impl(a, b, c, transB=1)
     expect(node, inputs=[a, b, c], outputs=[y], name='test_gemm_transposeB')
示例#22
0
 def export_beta():  # type: () -> None
     node = onnx.helper.make_node(
         'Gemm', inputs=['a', 'b', 'c'], outputs=['y'], beta=0.5
     )
     a = np.random.ranf([2, 7]).astype(np.float32)
     b = np.random.ranf([7, 4]).astype(np.float32)
     c = np.random.ranf([1, 4]).astype(np.float32)
     y = gemm_reference_impl(a, b, c, beta=0.5)
     expect(node, inputs=[a, b, c], outputs=[y], name='test_gemm_beta')
示例#23
0
    def export_right_unit8():  # type: () -> None
        node = onnx.helper.make_node(
            'BitShift', inputs=['x', 'y'], outputs=['z'], direction="RIGHT"
        )

        x = np.array([16, 4, 1]).astype(np.uint8)
        y = np.array([1, 2, 3]).astype(np.uint8)
        z = x >> y  # expected output [8, 1, 0]
        expect(node, inputs=[x, y], outputs=[z], name='test_bitshift_right_uint8')
示例#24
0
    def export_left_unit64():  # type: () -> None
        node = onnx.helper.make_node(
            'BitShift', inputs=['x', 'y'], outputs=['z'], direction="LEFT"
        )

        x = np.array([16, 4, 1]).astype(np.uint64)
        y = np.array([1, 2, 3]).astype(np.uint64)
        z = x << y  # expected output [32, 16, 8]
        expect(node, inputs=[x, y], outputs=[z], name='test_bitshift_left_uint64')
示例#25
0
 def export_keepdims():  # type: () -> None
     node = onnx.helper.make_node(
         'ReduceLogSum', inputs=['data'], outputs=["reduced"]
     )
     data = np.random.ranf([3, 4, 5]).astype(np.float32)
     reduced = np.log(np.sum(data, keepdims=True))
     expect(
         node, inputs=[data], outputs=[reduced], name='test_reduce_log_sum_default'
     )
示例#26
0
    def export():  # type: () -> None
        node = onnx.helper.make_node(
            'Erf',
            inputs=['x'],
            outputs=['y'],
        )

        x = np.random.randn(1, 3, 32, 32).astype(np.float32)
        y = np.vectorize(math.erf)(x).astype(np.float32)
        expect(node, inputs=[x], outputs=[y], name='test_erf')
示例#27
0
 def export_leakyrelu_default():  # type: () -> None
     default_alpha = 0.01
     node = onnx.helper.make_node(
         'LeakyRelu',
         inputs=['x'],
         outputs=['y'],
     )
     x = np.random.randn(3, 4, 5).astype(np.float32)
     y = np.clip(x, 0, np.inf) + np.clip(x, -np.inf, 0) * default_alpha
     expect(node, inputs=[x], outputs=[y], name='test_leakyrelu_default')
示例#28
0
    def export():  # type: () -> None
        node = onnx.helper.make_node(
            'IsNaN',
            inputs=['x'],
            outputs=['y'],
        )

        x = np.array([3.0, np.nan, 4.0, np.nan], dtype=np.float32)
        y = np.isnan(x)
        expect(node, inputs=[x], outputs=[y], name='test_isnan')
示例#29
0
    def export():  # type: () -> None
        node = onnx.helper.make_node(
            'Add',
            inputs=['x', 'y'],
            outputs=['sum'],
        )

        x = np.random.randn(3, 4, 5).astype(np.float32)
        y = np.random.randn(3, 4, 5).astype(np.float32)
        expect(node, inputs=[x, y], outputs=[x + y], name='test_add')
示例#30
0
    def export():  # type: () -> None
        node = onnx.helper.make_node(
            'HardSwish',
            inputs=['x'],
            outputs=['y'],
        )
        x = np.random.randn(3, 4, 5).astype(np.float32)
        y = hardswish(x)

        expect(node, inputs=[x], outputs=[y], name='test_hardswish')