Skip to content

Commit fb88432

Browse files
committed
Fix
1 parent 23384e5 commit fb88432

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

python/paddle/nn/functional/common.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1959,8 +1959,12 @@ def pad(
19591959
], f"mode should be one of constant, reflect, replicate, circular, but got {mode}."
19601960

19611961
x_dim = len(x.shape)
1962-
if isinstance(pad, (Variable, pir.Value, paddle.Tensor)) and pad.size == 0:
1963-
return x.clone()
1962+
if in_dynamic_or_pir_mode():
1963+
if (
1964+
isinstance(pad, (Variable, pir.Value, paddle.Tensor))
1965+
and pad.size == 0
1966+
):
1967+
return x.clone()
19641968
if (
19651969
mode == "constant"
19661970
and isinstance(pad, (list, tuple))

0 commit comments

Comments
 (0)