-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Implement selectedrows serialize and deserialize #7042
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
Merged
Yancey0623
merged 9 commits into
PaddlePaddle:develop
from
Yancey0623:selected_row_serialized
Dec 28, 2017
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
f91e769
implement selectedrows serialize and deserialize
Yancey0623 842d881
make serialize/deserialize as global function
Yancey0623 7dd129f
recover send_imp.cc
Yancey0623 bedbc14
delete unused brackets
Yancey0623 cb6aeff
fix compile error
Yancey0623 8ea49bd
serialize version in LodTensor and SelecetedRows
Yancey0623 57218ea
Merge branch 'develop' of github.com:PaddlePaddle/Paddle into selecte…
Yancey0623 d279283
fix ci
Yancey0623 75aff5a
fix ci
Yancey0623 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,5 +43,19 @@ TEST_F(SelectedRowsTester, complete_dims) { | |
ASSERT_EQ(selected_rows_->GetCompleteDims(), make_ddim({10, 100})); | ||
} | ||
|
||
TEST_F(SelectedRowsTester, SerializeAndDeseralize) { | ||
SelectedRows dst_tensor; | ||
platform::CPUDeviceContext cpu_ctx(place_); | ||
std::ostringstream oss; | ||
|
||
SerializeToStream(oss, *selected_rows_, cpu_ctx); | ||
|
||
std::istringstream iss(oss.str()); | ||
DeserializeFromStream(iss, &dst_tensor); | ||
|
||
ASSERT_EQ(selected_rows_->rows(), dst_tensor.rows()); | ||
ASSERT_EQ(selected_rows_->height(), dst_tensor.height()); | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Need GPU Test and SerializeToStream should copy to CPU if element is in GPU There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add the test in tensor_util_test. |
||
} // namespace framework | ||
} // namespace paddle |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Tensor is decoupled from proto. Why we need the link with framework_proto?
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.
Serialize need the Tensor description, and serialize to a proto message is a simple way, so link the framework_proto.