diff --git a/oneflow/core/functional/functional_api.yaml b/oneflow/core/functional/functional_api.yaml index 3e4315b3a19..b10513793fe 100755 --- a/oneflow/core/functional/functional_api.yaml +++ b/oneflow/core/functional/functional_api.yaml @@ -704,23 +704,23 @@ - name: "conv1d" signature: - "Tensor (Tensor x, Tensor weight, Tensor bias=None, Int32List[1] stride, - Int32List[1] padding, Int32List[1] dilation, Int32 groups=1, - String channel_pos) => Conv1d" + "Tensor (Tensor x, Tensor weight, Tensor bias=None, Int32List[1] stride=1, + Int32List[1] padding=0, Int32List[1] dilation=1, Int32 groups=1, + String channel_pos=\"channels_first\") => Conv1d" bind_python: True - name: "conv2d" signature: - "Tensor (Tensor x, Tensor weight, Tensor bias=None, Int32List[2] stride, - Int32List[2] padding, Int32List[2] dilation, Int32 groups=1, - String channel_pos) => Conv2d" + "Tensor (Tensor x, Tensor weight, Tensor bias=None, Int32List[2] stride=1, + Int32List[2] padding=0, Int32List[2] dilation=1, Int32 groups=1, + String channel_pos=\"channels_first\") => Conv2d" bind_python: True - name: "conv3d" signature: - "Tensor (Tensor x, Tensor weight, Tensor bias=None, Int32List[3] stride, - Int32List[3] padding, Int32List[3] dilation, Int32 groups=1, - String channel_pos) => Conv3d" + "Tensor (Tensor x, Tensor weight, Tensor bias=None, Int32List[3] stride=1, + Int32List[3] padding=0, Int32List[3] dilation=1, Int32 groups=1, + String channel_pos=\"channels_first\") => Conv3d" bind_python: True - name: "fake_quantization" diff --git a/python/oneflow/test/modules/test_conv1d.py b/python/oneflow/test/modules/test_conv1d.py index 1e86281aae8..fa1c9984ef3 100644 --- a/python/oneflow/test/modules/test_conv1d.py +++ b/python/oneflow/test/modules/test_conv1d.py @@ -435,6 +435,14 @@ def test_conv1d(test_case): for arg in GenArgList(arg_dict): arg[0](test_case, *arg[1:]) + @autotest(n=3) + def test_nn_functional_conv1d(test_case): + device = random_device() + img = torch.ones((1, 3, 224), requires_grad=True).to(device) + kernel = torch.ones((3, 1, 3), requires_grad=True).to(device) + y = torch.nn.functional.conv1d(img, kernel, groups=3) + return y + @autotest() def test_conv1d_with_random_data(test_case): channels = random(1, 6) diff --git a/python/oneflow/test/modules/test_conv2d.py b/python/oneflow/test/modules/test_conv2d.py index 6c89ccf4647..7e58a552fcb 100644 --- a/python/oneflow/test/modules/test_conv2d.py +++ b/python/oneflow/test/modules/test_conv2d.py @@ -1581,6 +1581,14 @@ def test_conv2d_default_init(test_case): ) ) + @autotest(n=3) + def test_nn_functional_conv2d(test_case): + device = random_device() + img = torch.ones((1, 3, 224, 224), requires_grad=True).to(device) + kernel = torch.ones((3, 1, 3, 3), requires_grad=True).to(device) + y = torch.nn.functional.conv2d(img, kernel, groups=3) + return y + def test_conv2d(test_case): arg_dict = OrderedDict() arg_dict["device"] = ["cuda", "cpu"] diff --git a/python/oneflow/test/modules/test_conv3d.py b/python/oneflow/test/modules/test_conv3d.py index 345e1e05d0c..01701005166 100644 --- a/python/oneflow/test/modules/test_conv3d.py +++ b/python/oneflow/test/modules/test_conv3d.py @@ -22,6 +22,14 @@ @flow.unittest.skip_unless_1n1d() class TestConv3DModule(flow.unittest.TestCase): + @autotest(n=3) + def test_nn_functional_conv3d(test_case): + device = random_device() + img = torch.ones((1, 3, 224, 224, 224), requires_grad=True).to(device) + kernel = torch.ones((6, 3, 3, 3, 3), requires_grad=True).to(device) + y = torch.nn.functional.conv3d(img, kernel) + return y + @autotest(n=10) def test_conv3d_with_random_data(test_case): channels = random(1, 6)