Skip to content

Commit 46d4947

Browse files
authored
use rules.ALL_RULES instead of rules.__all__ (#593)
1 parent 66f70f7 commit 46d4947

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

tester/paddle_to_torch/converter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def _load_mapping_and_rules(self):
2828
"GenericRule": GenericRule,
2929
"ErrorRule": ErrorRule,
3030
}
31-
for rule_name in rules.__all__:
31+
for rule_name in rules.ALL_RULES:
3232
rule_cls_map[rule_name] = getattr(rules, rule_name)
3333

3434
mapping_file = os.path.join(os.path.dirname(os.path.abspath(__file__)), "mapping.json")

tester/paddle_to_torch/rules.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6536,3 +6536,10 @@ def logical_right_shift(x: torch.Tensor, y: torch.Tensor):
65366536
"""
65376537
code = Code(preprocess=pre.splitlines(), core=core.splitlines())
65386538
return ConvertResult.success(paddle_api, code, is_torch_corresponding=False)
6539+
6540+
6541+
ALL_RULES = [
6542+
cls.__name__
6543+
for cls in globals().values()
6544+
if isinstance(cls, type) and issubclass(cls, BaseRule) and cls != BaseRule
6545+
]

0 commit comments

Comments
 (0)