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

fix set_value when source tensor is fp16 dtype and index is scalar tensor #50340

Merged

Conversation

Courtesy-Xs
Copy link
Contributor

PR types

Bug fixes

PR changes

Others

Describe

when code set like the following runs in paddle, it will failed because paddle doesn't support assign when source tensor is fp16 type and index is scalar tensor,.
it's restricted by set_value mechanism and its component will be reconstructed soon, so here we just make minor changes for this program runs correctly

import paddle
cls_targets = paddle.full([3,3],0,dtype="float16")
ix1 = paddle.full([1],1,dtype="int64")
ix2 = paddle.full([1],2,dtype="int64")
cls_targets[ix1,ix2]= 1
print(cls_targets)

@paddle-bot
Copy link

paddle-bot bot commented Feb 8, 2023

你的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.

Copy link
Contributor

@zhangting2020 zhangting2020 left a comment

Choose a reason for hiding this comment

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

LGTM

@zhangting2020 zhangting2020 merged commit b3f60f3 into PaddlePaddle:develop Feb 9, 2023
@Courtesy-Xs Courtesy-Xs deleted the fix_set_value_65965 branch July 7, 2023 03:14
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