Skip to content

Commit

Permalink
Merge pull request PaddlePaddle#1154 from HexToString/fix_grpc_bug
Browse files Browse the repository at this point in the history
fix reader-op log bug
  • Loading branch information
bjjwwang authored and TeslaZhao committed Apr 20, 2021
1 parent a6b9c21 commit 9c4ce45
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions core/general-server/op/general_reader_op.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,15 +157,13 @@ int GeneralReaderOp::inference() {
}
// implement lod tensor here
// only support 1-D lod
// TODO:support 2-D lod
// TODO(HexToString): support 2-D lod
if (tensor.lod_size() > 0) {
VLOG(2) << "(logid=" << log_id << ") var[" << i << "] is lod_tensor";
lod_tensor.lod.resize(1);
for (int k = 0; k < tensor.lod_size(); ++k) {
lod_tensor.lod[0].push_back(tensor.lod(k));
}
VLOG(2) << "(logid=" << log_id << ") var[" << i
<< "] has lod_tensor and len=" << out->at(i).lod[0].back();
}

for (int k = 0; k < tensor.shape_size(); ++k) {
Expand All @@ -180,7 +178,10 @@ int GeneralReaderOp::inference() {
<< "]: " << data_len;
databuf_size[i] = data_len * elem_size[i];
out->at(i).data.Resize(data_len * elem_size[i]);

if (out->at(i).lod.size() > 0) {
VLOG(2) << "(logid=" << log_id << ") var[" << i
<< "] has lod_tensor and len=" << out->at(i).lod[0].back();
}
if (elem_type[i] == P_INT64) {
int64_t *dst_ptr = static_cast<int64_t *>(out->at(i).data.data());
VLOG(2) << "(logid=" << log_id << ") first element data in var[" << i
Expand Down

0 comments on commit 9c4ce45

Please sign in to comment.