Modify Pybind LoDTensor API according to length-based LoD#11106
Merged
kexinzhao merged 16 commits intoPaddlePaddle:developfrom Jun 15, 2018
Merged
Modify Pybind LoDTensor API according to length-based LoD#11106kexinzhao merged 16 commits intoPaddlePaddle:developfrom
kexinzhao merged 16 commits intoPaddlePaddle:developfrom
Conversation
077235f to
ae366a8
Compare
77fd3d5 to
75816da
Compare
75816da to
6b11525
Compare
panyx0718
previously approved these changes
Jun 15, 2018
paddle/fluid/pybind/pybind.cc
Outdated
| std::back_inserter(new_lod)); | ||
| LoD new_offset_lod = ConvertToOffsetBasedLoD(new_lod); | ||
| PADDLE_ENFORCE(CheckLoD(new_offset_lod, -1), | ||
| "the provided lod info is invalid"); |
Contributor
There was a problem hiding this comment.
lod to reursive_sequence_lengths?
Contributor
|
Those failed tests. I'm wondering if the test can |
61cc22a to
d7fb929
Compare
d7fb929 to
051d7e6
Compare
Contributor
Author
|
@panyx0718 I have catch the exceptions in the |
panyx0718
approved these changes
Jun 15, 2018
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Some background can be found here.
Essentially, our level of detail info (LoD) is currently both implemented in C++ and exposed in Python using "offsets". We want to encapsulate the
offsetimplementation detail in C++ and only exposelengthbased interface in Python.What this PR does (See the main change in
pybind.cchere):Previously, the
set_lodandlodAPI inpybind.ccuses offset_based LoD.This PR modifies the LoDTensor API in
pybind.ccso that the user on the python side can provide or obtain length-based LoD usingset_lodandlod, respectively.The
initAPI is also modified so that user can create a LoDTensor object in Python and initialize it with a length-based LoD.A
has_valid_lodAPI is added inpybind.ccso that user can check if the LoD info in a tensor is valid and matches the its data dimension on the python side.Utility functions to create LoDTensor in the python side defined here is largely simplified using the updated
set_lodandlodin pybind. (See changes here)Over 30 tests that uses
set_lodandlodhas been modified to reflect the updated LoDTensor API inpybind.cc.