-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
add API for copying data from/to paddle matrix #5519
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for this change!
I am approving this change, and please feel free to merge it.
I would highly recommend adding related GPU/CPU unit tests. Please feel free to add them in this PR, or file another PR after merging this one. I created a reminder as an issue #5528; please remember to add "Fix #5528" text in the PR that fix it. For more details about the test, Github Documentation provides more information.
Also adding a corresponding example under |
@typhoonzero Sounds good. I've add the example in the recent commit. |
@wangkuiyi Thanks. I've add the related units test in the recent commit. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM++
also Fix #5528 |
fix #5490
使用C-API进行预测时,要求把特征数据拷贝到输入matrix中,当网络推理完成后,需要从输出matrix把结果拷贝出来。目前的C-API只提供了paddle_matrix_set_row函数去逐行设置数据,且不提供数据从matrix拷贝出来的功能。当使用GPU进行推理时,输出matrix的结果保存在GPU中,想从中获取数据尤其麻烦。
本次commit提供了paddle_matrix_set_value/paddle_matrix_get_value, 方便设置和获取matrix的值。