Skip to content

Commit

Permalink
【Hackathon 7th No.38】为 Paddle 代码转换工具新增 API 转换规则(第5组) (#496)
Browse files Browse the repository at this point in the history
* 【Hackathon 7th No.38】为 Paddle 代码转换工具新增 API 转换规则(第5组)

* fix_

* fix

* fix

* fix

* fix_

* fix_

* fix

* fix

* hkt 7th No.38

* fix

* fix

* fix

* fix

* fix
  • Loading branch information
inaomIIsfarell authored Nov 12, 2024
1 parent edbae41 commit 5f91749
Show file tree
Hide file tree
Showing 19 changed files with 1,371 additions and 110 deletions.
1 change: 1 addition & 0 deletions paconvert/api_alias_mapping.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"torch.bilinear": "torch.nn.functional.bilinear",
"torch.celu_": "torch.nn.functional.celu_",
"torch.channel_shuffle": "torch.nn.functional.channel_shuffle",
"torch.concatenate": "torch.cat",
"torch.clip": "torch.clamp",
"torch.conv1d": "torch.nn.functional.conv1d",
"torch.conv2d": "torch.nn.functional.conv2d",
Expand Down
165 changes: 160 additions & 5 deletions paconvert/api_mapping.json
Original file line number Diff line number Diff line change
Expand Up @@ -2215,9 +2215,21 @@
"paddle_api": "paddle.Tensor.isnan",
"min_input_args": 0
},
"torch.Tensor.isneginf": {},
"torch.Tensor.isposinf": {},
"torch.Tensor.isreal": {},
"torch.Tensor.isneginf": {
"Matcher": "GenericMatcher",
"paddle_api": "paddle.Tensor.isneginf",
"min_input_args": 0
},
"torch.Tensor.isposinf": {
"Matcher": "GenericMatcher",
"paddle_api": "paddle.Tensor.isposinf",
"min_input_args": 0
},
"torch.Tensor.isreal": {
"Matcher": "GenericMatcher",
"paddle_api": "paddle.Tensor.isreal",
"min_input_args": 0
},
"torch.Tensor.istft": {
"Matcher": "GenericMatcher",
"paddle_api": "paddle.Tensor.istft",
Expand Down Expand Up @@ -3179,7 +3191,9 @@
"n"
]
},
"torch.Tensor.positive": {},
"torch.Tensor.positive": {
"Matcher": "PositiveMatcher"
},
"torch.Tensor.pow": {
"Matcher": "GenericMatcher",
"paddle_api": "paddle.Tensor.pow",
Expand Down Expand Up @@ -3556,7 +3570,27 @@
"reduce": "'add'"
}
},
"torch.Tensor.scatter_reduce": {},
"torch.Tensor.scatter_reduce": {
"Matcher": "ScatterReduceMatcher",
"paddle_api": "paddle.Tensor.put_along_axis",
"min_input_args": 3,
"args_list": [
"dim",
"index",
"src",
"reduce",
"*",
"include_self"
],
"kwargs_change": {
"dim": "axis",
"index": "indices",
"src": "values"
},
"paddle_default_kwargs": {
"broadcast": "False"
}
},
"torch.Tensor.scatter_reduce_": {},
"torch.Tensor.select": {
"Matcher": "SelectMatcher",
Expand Down Expand Up @@ -5251,6 +5285,17 @@
"window": "'blackman'"
}
},
"torch.block_diag": {
"Matcher": "SimpleScalableVarMatcher",
"paddle_api": "paddle.block_diag",
"min_input_args": 1,
"args_list": [
"*tensors"
],
"kwargs_change": {
"tensors": "inputs"
}
},
"torch.bmm": {
"Matcher": "GenericMatcher",
"paddle_api": "paddle.bmm",
Expand Down Expand Up @@ -5315,6 +5360,24 @@
"boundaries": "sorted_sequence"
}
},
"torch.can_cast": {
"Matcher": "CanCastMatcher",
"args_list": [
"from_",
"to"
]
},
"torch.cartesian_prod": {
"Matcher": "SimpleScalableVarMatcher",
"paddle_api": "paddle.cartesian_prod",
"min_input_args": 1,
"args_list": [
"*tensors"
],
"kwargs_change": {
"tensors": "x"
}
},
"torch.cat": {
"Matcher": "GenericMatcher",
"paddle_api": "paddle.concat",
Expand Down Expand Up @@ -7786,6 +7849,16 @@
"input": "x"
}
},
"torch.float_power": {
"Matcher": "FloatPowerMatcher",
"min_input_args": 2,
"args_list": [
"input",
"exponent",
"*",
"out"
]
},
"torch.floor_divide": {
"Matcher": "Num2TensorBinaryMatcher",
"paddle_api": "paddle.floor_divide",
Expand Down Expand Up @@ -8495,6 +8568,22 @@
"input": "x"
}
},
"torch.isin": {
"Matcher": "GenericMatcher",
"paddle_api": "paddle.isin",
"min_input_args": 2,
"args_list": [
"elements",
"test_elements",
"*",
"assume_unique",
"invert"
],
"kwargs_change": {
"elements": "x",
"test_elements": "test_x"
}
},
"torch.isinf": {
"Matcher": "GenericMatcher",
"paddle_api": "paddle.isinf",
Expand All @@ -8517,6 +8606,43 @@
"input": "x"
}
},
"torch.isneginf": {
"Matcher": "GenericMatcher",
"paddle_api": "paddle.isneginf",
"min_input_args": 1,
"args_list": [
"input",
"*",
"out"
],
"kwargs_change": {
"input": "x"
}
},
"torch.isposinf": {
"Matcher": "GenericMatcher",
"paddle_api": "paddle.isposinf",
"min_input_args": 1,
"args_list": [
"input",
"*",
"out"
],
"kwargs_change": {
"input": "x"
}
},
"torch.isreal": {
"Matcher": "GenericMatcher",
"paddle_api": "paddle.isreal",
"min_input_args": 1,
"args_list": [
"input"
],
"kwargs_change": {
"input": "x"
}
},
"torch.istft": {
"Matcher": "GenericMatcher",
"paddle_api": "paddle.signal.istft",
Expand Down Expand Up @@ -14781,6 +14907,12 @@
"out"
]
},
"torch.positive": {
"Matcher": "PositiveMatcher",
"args_list": [
"input"
]
},
"torch.pow": {
"Matcher": "GenericMatcher",
"paddle_api": "paddle.pow",
Expand Down Expand Up @@ -15300,6 +15432,29 @@
"reduce": "'add'"
}
},
"torch.scatter_reduce": {
"Matcher": "ScatterReduceMatcher",
"paddle_api": "paddle.put_along_axis",
"min_input_args": 4,
"args_list": [
"input",
"dim",
"index",
"src",
"reduce",
"*",
"include_self"
],
"kwargs_change": {
"input": "arr",
"dim": "axis",
"index": "indices",
"src": "values"
},
"paddle_default_kwargs": {
"broadcast": "False"
}
},
"torch.searchsorted": {
"Matcher": "SearchsortedMatcher",
"paddle_api": "paddle.searchsorted",
Expand Down
Loading

0 comments on commit 5f91749

Please sign in to comment.