Skip to content

Commit

Permalink
fix dnn dump error (#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
qingshui authored Oct 23, 2020
1 parent f263bd7 commit fd717a3
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions paddle/fluid/framework/data_feed.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1937,17 +1937,18 @@ void PaddleBoxDataFeed::PutToFeedVec(const std::vector<Record*>& ins_vec) {

std::vector<size_t> lodinfo(col_size, 0);
for (size_t i = 0; i < use_slots_.size(); ++i) {
memcpy(lodinfo.data(), offset.data() + index_map[i] * col_size,
col_size * sizeof(size_t));
LoD lod{lodinfo};
feed_vec_[i]->set_lod(lod);
if (use_slots_is_dense_[i]) {
if (inductive_shape_index_[i] != -1) {
use_slots_shape_[i][inductive_shape_index_[i]] =
offset[(index_map[i] + 1) * col_size - 1] /
total_dims_without_inductive_[i];
}
feed_vec_[i]->Resize(framework::make_ddim(use_slots_shape_[i]));
} else {
memcpy(lodinfo.data(), offset.data() + index_map[i] * col_size,
col_size * sizeof(size_t));
LoD lod{lodinfo};
feed_vec_[i]->set_lod(lod);
}
}
#endif
Expand Down Expand Up @@ -2308,15 +2309,15 @@ void SlotPaddleBoxDataFeed::PutToFeedSlotVec(const SlotRecord* ins_vec,
CopyToFeedTensor(tensor_ptr, feasign, total_instance * sizeof(int64_t));
}

LoD data_lod{slot_offset};
feed_vec_[j]->set_lod(data_lod);

if (info.dense) {
if (info.inductive_shape_index != -1) {
info.local_shape[info.inductive_shape_index] =
total_instance / info.total_dims_without_inductive;
}
feed->Resize(framework::make_ddim(info.local_shape));
} else {
LoD data_lod{slot_offset};
feed_vec_[j]->set_lod(data_lod);
}
}
#endif
Expand Down Expand Up @@ -2414,19 +2415,19 @@ void SlotPaddleBoxDataFeed::BuildSlotBatchGPU(const int ins_num) {
feed->mutable_data<int64_t>({total_instance, 1}, this->place_);
}
}
// feed->set_lod({offsets});
LoD& lod = (*feed->mutable_lod());
lod.resize(1);
lod[0].resize(offset_cols_size);
memcpy(lod[0].MutableData(platform::CPUPlace()), off_start_ptr,
offset_cols_size * sizeof(size_t));

if (info.dense) {
if (info.inductive_shape_index != -1) {
info.local_shape[info.inductive_shape_index] =
total_instance / info.total_dims_without_inductive;
}
feed->Resize(framework::make_ddim(info.local_shape));
} else {
LoD& lod = (*feed->mutable_lod());
lod.resize(1);
lod[0].resize(offset_cols_size);
memcpy(lod[0].MutableData(platform::CPUPlace()), off_start_ptr,
offset_cols_size * sizeof(size_t));
}
}
data_timer_.Pause();
Expand Down

0 comments on commit fd717a3

Please sign in to comment.