Skip to content

Commit 9380862

Browse files
committed
[API-Compat] More efficient forbid-keyword decorator
1 parent a1a1ca7 commit 9380862

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

python/paddle/tensor/compat.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535

3636

3737
@ForbidKeywordsDecorator(
38-
illegal_keys=["x", "num_or_sections", "axis", "name"],
38+
illegal_keys={"x", "num_or_sections", "axis", "name"},
3939
func_name="paddle.compat.split",
4040
correct_name="paddle.split",
4141
)

python/paddle/tensor/manipulation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2737,7 +2737,7 @@ def row_stack(x: Sequence[Tensor], name: str | None = None) -> Tensor:
27372737

27382738

27392739
@ForbidKeywordsDecorator(
2740-
illegal_keys=["tensor", "split_size_or_sections", "dim"],
2740+
illegal_keys={"tensor", "split_size_or_sections", "dim"},
27412741
func_name="paddle.split",
27422742
correct_name="paddle.compat.split",
27432743
)

test/legacy_test/test_compat_split.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ def test_error_hint(self):
136136
x = paddle.randn([3, 9, 5])
137137

138138
msg_gt_1 = (
139-
"paddle.split() received unexpected keyword arguments 'tensor', 'split_size_or_sections', 'dim'. "
139+
"paddle.split() received unexpected keyword arguments 'dim', 'split_size_or_sections', 'tensor'. "
140140
"\nDid you mean to use paddle.compat.split() instead?"
141141
)
142142
msg_gt_2 = (

0 commit comments

Comments
 (0)