Skip to content

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

@paddle-bot
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
Copy link
Member

@SigureMo SigureMo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTMeow 🐾

@zhangbo9674 zhangbo9674 merged commit 4619582 into PaddlePaddle:develop Dec 19, 2024
28 checks passed
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.

2 participants