Skip to content

Commit 42cd586

Browse files
committed
fix
1 parent f02c15e commit 42cd586

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

python/paddle/tensor/manipulation.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3468,7 +3468,11 @@ def expand(x, shape, name=None):
34683468
# [[1, 2, 3], [1, 2, 3]]
34693469
"""
34703470
if in_dynamic_or_pir_mode():
3471-
if in_pir_mode():
3471+
if (
3472+
in_pir_mode()
3473+
and isinstance(shape, (list, tuple))
3474+
and paddle.utils._contain_var(shape)
3475+
):
34723476
shape = paddle.utils._convert_to_tensor_list(shape)
34733477
return _C_ops.expand(x, shape)
34743478
else:

0 commit comments

Comments
 (0)