`paddle.jit.to_static(full_graph=True)` segfaults on `paddle.static.nn.cond` while eager mode works
type/bug-reportstatus/close
### bug描述 Describe the Bug
`paddle.static.nn.cond` works in eager mode, but wrapping the same logic with
`paddle.jit.to_static(full_graph=True)` causes a segmentation fault.
### Minimal reproducible example
```python
import paddle
a = paddle.ones([1])
def true_fn():
return a + 0.0
def false_fn():
return paddle.zeros([1]) + 0.0
def eager_fn(cond):
return paddle.static.nn.cond(cond, true_fn, false_fn)
print("eager:", eager_fn(paddle.to_tensor(True)))
@paddle.jit.to_static(full_graph=True)
def static_fn(cond):
return paddle.static.nn.cond(cond, true_fn, false_fn)
print("static:", static_fn(paddle.to_tensor(True)))
```
### Reproduction result
Eager mode works normally.
to_static(full_graph=True) causes a segmentation fault.
### 其他补充信息 Additional Supplementary Information
Paddle version: 3.3
关闭于 2026-04-22 2 条评论