Skip to content

Commit eccdfab

Browse files
committed
Merge branch 'master' of https://github.com/paddlepaddle/paconvert into ApiEnhance11_16
2 parents d249fb4 + 0c9c02c commit eccdfab

10 files changed

Lines changed: 88 additions & 264 deletions

paconvert/api_mapping.json

Lines changed: 12 additions & 171 deletions
Original file line numberDiff line numberDiff line change
@@ -7164,59 +7164,16 @@
71647164
"paddle_api": "paddle.compat.max"
71657165
},
71667166
"torch.max_pool1d": {
7167-
"Matcher": "GenericMatcher",
7168-
"paddle_api": "paddle.nn.functional.max_pool1d",
7169-
"min_input_args": 2,
7170-
"args_list": [
7171-
"input",
7172-
"kernel_size",
7173-
"stride",
7174-
"padding",
7175-
"dilation",
7176-
"ceil_mode"
7177-
],
7178-
"kwargs_change": {
7179-
"input": "x"
7180-
},
7181-
"unsupport_args": [
7182-
"dilation"
7183-
]
7167+
"Matcher": "ChangeAPIMatcher",
7168+
"paddle_api": "paddle.nn.functional.max_pool1d"
71847169
},
71857170
"torch.max_pool2d": {
7186-
"Matcher": "GenericMatcher",
7187-
"paddle_api": "paddle.nn.functional.max_pool2d",
7188-
"args_list": [
7189-
"input",
7190-
"kernel_size",
7191-
"stride",
7192-
"padding",
7193-
"dilation",
7194-
"ceil_mode"
7195-
],
7196-
"kwargs_change": {
7197-
"input": "x"
7198-
},
7199-
"unsupport_args": [
7200-
"dilation"
7201-
]
7171+
"Matcher": "ChangeAPIMatcher",
7172+
"paddle_api": "paddle.nn.functional.max_pool2d"
72027173
},
72037174
"torch.max_pool3d": {
7204-
"Matcher": "GenericMatcher",
7205-
"paddle_api": "paddle.nn.functional.max_pool3d",
7206-
"args_list": [
7207-
"input",
7208-
"kernel_size",
7209-
"stride",
7210-
"padding",
7211-
"dilation",
7212-
"ceil_mode"
7213-
],
7214-
"kwargs_change": {
7215-
"input": "x"
7216-
},
7217-
"unsupport_args": [
7218-
"dilation"
7219-
]
7175+
"Matcher": "ChangeAPIMatcher",
7176+
"paddle_api": "paddle.nn.functional.max_pool3d"
72207177
},
72217178
"torch.maximum": {
72227179
"Matcher": "ChangePrefixMatcher"
@@ -7874,9 +7831,6 @@
78747831
"return_indices",
78757832
"_random_samples"
78767833
],
7877-
"kwargs_change": {
7878-
"return_indices": "return_mask"
7879-
},
78807834
"unsupport_args": [
78817835
"output_ratio",
78827836
"_random_samples"
@@ -7893,9 +7847,6 @@
78937847
"return_indices",
78947848
"_random_samples"
78957849
],
7896-
"kwargs_change": {
7897-
"return_indices": "return_mask"
7898-
},
78997850
"unsupport_args": [
79007851
"output_ratio",
79017852
"_random_samples"
@@ -8214,61 +8165,13 @@
82148165
"min_input_args": 0
82158166
},
82168167
"torch.nn.MaxPool1d": {
8217-
"Matcher": "GenericMatcher",
8218-
"paddle_api": "paddle.nn.MaxPool1D",
8219-
"args_list": [
8220-
"kernel_size",
8221-
"stride",
8222-
"padding",
8223-
"dilation",
8224-
"return_indices",
8225-
"ceil_mode"
8226-
],
8227-
"kwargs_change": {
8228-
"return_indices": "return_mask"
8229-
},
8230-
"unsupport_args": [
8231-
"dilation"
8232-
],
8233-
"min_input_args": 1
8168+
"Matcher": "ChangePrefixMatcher"
82348169
},
82358170
"torch.nn.MaxPool2d": {
8236-
"Matcher": "GenericMatcher",
8237-
"paddle_api": "paddle.nn.MaxPool2D",
8238-
"args_list": [
8239-
"kernel_size",
8240-
"stride",
8241-
"padding",
8242-
"dilation",
8243-
"return_indices",
8244-
"ceil_mode"
8245-
],
8246-
"kwargs_change": {
8247-
"return_indices": "return_mask"
8248-
},
8249-
"unsupport_args": [
8250-
"dilation"
8251-
],
8252-
"min_input_args": 1
8171+
"Matcher": "ChangePrefixMatcher"
82538172
},
82548173
"torch.nn.MaxPool3d": {
8255-
"Matcher": "GenericMatcher",
8256-
"paddle_api": "paddle.nn.MaxPool3D",
8257-
"args_list": [
8258-
"kernel_size",
8259-
"stride",
8260-
"padding",
8261-
"dilation",
8262-
"return_indices",
8263-
"ceil_mode"
8264-
],
8265-
"kwargs_change": {
8266-
"return_indices": "return_mask"
8267-
},
8268-
"unsupport_args": [
8269-
"dilation"
8270-
],
8271-
"min_input_args": 1
8174+
"Matcher": "ChangePrefixMatcher"
82728175
},
82738176
"torch.nn.MaxUnpool1d": {
82748177
"Matcher": "ChangePrefixMatcher"
@@ -9381,10 +9284,6 @@
93819284
"return_indices",
93829285
"_random_samples"
93839286
],
9384-
"kwargs_change": {
9385-
"input": "x",
9386-
"return_indices": "return_mask"
9387-
},
93889287
"unsupport_args": [
93899288
"_random_samples"
93909289
]
@@ -9401,10 +9300,6 @@
94019300
"return_indices",
94029301
"_random_samples"
94039302
],
9404-
"kwargs_change": {
9405-
"input": "x",
9406-
"return_indices": "return_mask"
9407-
},
94089303
"unsupport_args": [
94099304
"_random_samples"
94109305
]
@@ -9671,67 +9566,13 @@
96719566
"min_input_args": 3
96729567
},
96739568
"torch.nn.functional.max_pool1d": {
9674-
"Matcher": "GenericMatcher",
9675-
"paddle_api": "paddle.nn.functional.max_pool1d",
9676-
"args_list": [
9677-
"input",
9678-
"kernel_size",
9679-
"stride",
9680-
"padding",
9681-
"dilation",
9682-
"ceil_mode",
9683-
"return_indices"
9684-
],
9685-
"kwargs_change": {
9686-
"input": "x",
9687-
"return_indices": "return_mask"
9688-
},
9689-
"unsupport_args": [
9690-
"dilation"
9691-
],
9692-
"min_input_args": 0
9569+
"Matcher": "ChangePrefixMatcher"
96939570
},
96949571
"torch.nn.functional.max_pool2d": {
9695-
"Matcher": "GenericMatcher",
9696-
"paddle_api": "paddle.nn.functional.max_pool2d",
9697-
"args_list": [
9698-
"input",
9699-
"kernel_size",
9700-
"stride",
9701-
"padding",
9702-
"dilation",
9703-
"ceil_mode",
9704-
"return_indices"
9705-
],
9706-
"kwargs_change": {
9707-
"input": "x",
9708-
"return_indices": "return_mask"
9709-
},
9710-
"unsupport_args": [
9711-
"dilation"
9712-
],
9713-
"min_input_args": 0
9572+
"Matcher": "ChangePrefixMatcher"
97149573
},
97159574
"torch.nn.functional.max_pool3d": {
9716-
"Matcher": "GenericMatcher",
9717-
"paddle_api": "paddle.nn.functional.max_pool3d",
9718-
"args_list": [
9719-
"input",
9720-
"kernel_size",
9721-
"stride",
9722-
"padding",
9723-
"dilation",
9724-
"ceil_mode",
9725-
"return_indices"
9726-
],
9727-
"kwargs_change": {
9728-
"input": "x",
9729-
"return_indices": "return_mask"
9730-
},
9731-
"unsupport_args": [
9732-
"dilation"
9733-
],
9734-
"min_input_args": 0
9575+
"Matcher": "ChangePrefixMatcher"
97359576
},
97369577
"torch.nn.functional.max_unpool1d": {
97379578
"Matcher": "GenericMatcher",

tests/test_max_pool1d.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def test_case_7():
107107
result = torch.max_pool1d(input=input, kernel_size=5, stride=2, padding=2, dilation=1, ceil_mode=True)
108108
"""
109109
)
110-
obj.run(pytorch_code, unsupport=True, reason="Not support dilation")
110+
obj.run(pytorch_code, ["result"])
111111

112112

113113
def test_case_8():
@@ -120,7 +120,7 @@ def test_case_8():
120120
result = torch.max_pool1d(input, 5, 2, 2, 1, True)
121121
"""
122122
)
123-
obj.run(pytorch_code, unsupport=True, reason="Not support dilation")
123+
obj.run(pytorch_code, ["result"])
124124

125125

126126
def test_case_9():
@@ -133,4 +133,4 @@ def test_case_9():
133133
result = torch.max_pool1d(input=input, padding=2, kernel_size=5, dilation=1, stride=2, ceil_mode=True)
134134
"""
135135
)
136-
obj.run(pytorch_code, unsupport=True, reason="Not support dilation")
136+
obj.run(pytorch_code, ["result"])

tests/test_max_pool2d.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,7 @@ def test_case_4():
8484
result = torch.max_pool2d(input, 3, stride=(2, 1), padding=1, dilation=1)
8585
"""
8686
)
87-
obj.run(
88-
pytorch_code, ["result"], unsupport=True, reason="dilation is not supported now"
89-
)
87+
obj.run(pytorch_code, ["result"])
9088

9189

9290
def test_case_5():
@@ -120,9 +118,7 @@ def test_case_6():
120118
result = torch.max_pool2d(input=input, kernel_size=3, stride=(2, 1), padding=1, dilation=1, ceil_mode=True)
121119
"""
122120
)
123-
obj.run(
124-
pytorch_code, ["result"], unsupport=True, reason="dilation is not supported now"
125-
)
121+
obj.run(pytorch_code, ["result"])
126122

127123

128124
def test_case_7():
@@ -139,9 +135,7 @@ def test_case_7():
139135
result = torch.max_pool2d(input=input, stride=(2, 1), kernel_size=3, dilation=1, padding=1, ceil_mode=True)
140136
"""
141137
)
142-
obj.run(
143-
pytorch_code, ["result"], unsupport=True, reason="dilation is not supported now"
144-
)
138+
obj.run(pytorch_code, ["result"])
145139

146140

147141
def test_case_8():
@@ -158,6 +152,4 @@ def test_case_8():
158152
result = torch.max_pool2d(input, 3, (2, 1), 1, 1, True)
159153
"""
160154
)
161-
obj.run(
162-
pytorch_code, ["result"], unsupport=True, reason="dilation is not supported now"
163-
)
155+
obj.run(pytorch_code, ["result"])

tests/test_max_pool3d.py

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,7 @@ def test_case_2():
3838
result = torch.max_pool3d(input, 3, 1, 1, 2, True)
3939
"""
4040
)
41-
obj.run(
42-
pytorch_code, ["result"], unsupport=True, reason="dilation is not suppored now"
43-
)
41+
obj.run(pytorch_code, ["result"])
4442

4543

4644
def test_case_3():
@@ -73,12 +71,7 @@ def test_case_5():
7371
result, indices = torch.max_pool3d(input, 2, 2, 1, ceil_mode=True)
7472
"""
7573
)
76-
obj.run(
77-
pytorch_code,
78-
["result", "indices"],
79-
check_dtype=False,
80-
reason="torch indices dtype is int64, while paddle is int32",
81-
)
74+
obj.run(pytorch_code, ["result", "indices"])
8275

8376

8477
def test_case_6():
@@ -89,9 +82,7 @@ def test_case_6():
8982
result = torch.max_pool3d(input=input, kernel_size=(2, 2, 2), stride=(2, 1, 1), padding=1, dilation=1, ceil_mode=True)
9083
"""
9184
)
92-
obj.run(
93-
pytorch_code, ["result"], unsupport=True, reason="dilation is not suppored now"
94-
)
85+
obj.run(pytorch_code, ["result"])
9586

9687

9788
def test_case_7():
@@ -102,6 +93,4 @@ def test_case_7():
10293
result = torch.max_pool3d(input=input, dilation=1, kernel_size=(2, 2, 2), padding=1, stride=(2, 1, 1), ceil_mode=True)
10394
"""
10495
)
105-
obj.run(
106-
pytorch_code, ["result"], unsupport=True, reason="dilation is not suppored now"
107-
)
96+
obj.run(pytorch_code, ["result"])

0 commit comments

Comments
 (0)