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

add API for copying data from/to paddle matrix #5519

Merged
merged 3 commits into from
Nov 10, 2017

Conversation

QingshuChen
Copy link
Contributor

@QingshuChen QingshuChen commented Nov 9, 2017

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的值。

wangkuiyi
wangkuiyi previously approved these changes Nov 9, 2017
Copy link
Collaborator

@wangkuiyi wangkuiyi left a 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.

@typhoonzero
Copy link
Contributor

Also adding a corresponding example under examples/ would be awesome!

@QingshuChen
Copy link
Contributor Author

@typhoonzero Sounds good. I've add the example in the recent commit.

@QingshuChen
Copy link
Contributor Author

@wangkuiyi Thanks. I've add the related units test in the recent commit.

Copy link
Contributor

@typhoonzero typhoonzero left a comment

Choose a reason for hiding this comment

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

LGTM++

@typhoonzero typhoonzero merged commit f5dca05 into PaddlePaddle:develop Nov 10, 2017
@QingshuChen
Copy link
Contributor Author

also Fix #5528

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.

C-API使用GPU进行inference时,训练数据如何存入GPU_Matrix中?
4 participants