Skip to content

Commit 6eb073c

Browse files
fix reshape alias
1 parent ec714b6 commit 6eb073c

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

python/paddle/sparse/unary.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -882,7 +882,7 @@ def expm1(x: Tensor, name: str | None = None) -> Tensor:
882882
return _C_ops.sparse_expm1(x)
883883

884884

885-
@reshape_param_alias({"x": ["input"]})
885+
@reshape_param_alias({"x": "input"})
886886
def reshape(x: Tensor, shape: ShapeLike, name: str | None = None) -> Tensor:
887887
"""
888888
Changes the shape of ``x`` without changing its value, requiring x to be a SparseCooTensor or SparseCsrTensor.

python/paddle/tensor/manipulation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4979,7 +4979,7 @@ def get_attr_expand_shape(list_expand_shape):
49794979
return out
49804980

49814981

4982-
@reshape_param_alias({"x": ["input"]})
4982+
@reshape_param_alias({"x": "input"})
49834983
def reshape(x: Tensor, shape: ShapeLike, name: str | None = None) -> Tensor:
49844984
"""
49854985
Changes the shape of ``x`` without changing its data.

python/paddle/utils/decorator_utils.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,10 @@ def decorator(func):
9797
def wrapper(*args, **kwargs):
9898
if not kwargs:
9999
return func(*args, **kwargs)
100-
for original, aliases in alias_mapping.items():
101-
for alias in aliases:
102-
if alias in kwargs:
103-
if original not in kwargs:
104-
kwargs[original] = kwargs.pop(alias)
100+
for original, alias in alias_mapping.items():
101+
if alias in kwargs:
102+
if original not in kwargs:
103+
kwargs[original] = kwargs.pop(alias)
105104
# if "input" in kwargs:
106105
# if "x" not in kwargs:
107106
# kwargs["x"] = kwargs.pop("input")

0 commit comments

Comments
 (0)