Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Dy2st]Fix while to static bug #70287

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

zhangbo9674
Copy link
Contributor

@zhangbo9674 zhangbo9674 commented Dec 17, 2024

PR Category

Execute Infrastructure

PR Types

Bug fixes

Description

Fix to static bug of while op in this case:

import paddle
from paddle.jit import to_static

@to_static(full_graph=True)
def test():
    x = paddle.to_tensor(1, dtype='float32')
    y = paddle.to_tensor(False, dtype='bool')
    while y:
        x = 2
test()

Origin error is:

File "./paddle/static/nn/control_flow.py", line 952, in while_loop
        cf_yield([next_cond, *(var.next_var for var in variable_loop_vars)])
RuntimeError: Unable to cast Python instance of type <class 'int'> to C++ type '?' (#define PYBIND11_DETAILED_ERROR_MESSAGES or compile in debug mode for details) 

Pcard-67164

Copy link

paddle-bot bot commented Dec 17, 2024

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@zhangbo9674 zhangbo9674 marked this pull request as ready for review December 17, 2024 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant