Skip to content

Commit 80f6364

Browse files
authored
Add comments to set_lod. (#11588)
1 parent 2fdbc1c commit 80f6364

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

paddle/fluid/pybind/pybind.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,11 @@ PYBIND11_PLUGIN(core) {
159159
new (&instance) LoDTensor(new_offset_lod);
160160
})
161161
.def("__init__", [](LoDTensor &instance) { new (&instance) LoDTensor(); })
162+
// We implement offset based LOD in C++ while we use length based with
163+
// Python API. So we changed set_lod to set_recursive_sequence_lengths to
164+
// avoid misuse.
165+
// The discussion is here:
166+
// https://github.com/PaddlePaddle/Paddle/issues/10855
162167
.def("set_lod",
163168
[](LoDTensor &self, const std::vector<std::vector<size_t>> &lod) {
164169
// the input lod is offset-based level-of-detail info
@@ -199,6 +204,7 @@ PYBIND11_PLUGIN(core) {
199204
std::copy(lod.begin(), lod.end(), std::back_inserter(new_lod));
200205
return new_lod;
201206
})
207+
// Set above comments of set_lod.
202208
.def("recursive_sequence_lengths",
203209
[](LoDTensor &self) -> std::vector<std::vector<size_t>> {
204210
// output the length-based lod info

0 commit comments

Comments
 (0)