From 5a2cd4505b34af88a49ac5ca886b50a2e9b78430 Mon Sep 17 00:00:00 2001 From: wangguibao Date: Thu, 6 Dec 2018 20:55:21 +0800 Subject: [PATCH] AsyncExecutor bugfix: Tensor to LoDTensor test=develop --- paddle/fluid/framework/data_feed.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/paddle/fluid/framework/data_feed.cc b/paddle/fluid/framework/data_feed.cc index 9a4b115aeec..a99cf53b410 100644 --- a/paddle/fluid/framework/data_feed.cc +++ b/paddle/fluid/framework/data_feed.cc @@ -297,6 +297,7 @@ bool MultiSlotDataFeed::ParseOneInstance(std::vector* instance) { "the data, please check if the data contains unresolvable " "characters.\nplease check this error line: %s", str); + if (idx != -1) { (*instance)[idx].Init(all_slots_type_[i]); if ((*instance)[idx].GetType()[0] == 'f') { // float @@ -333,6 +334,7 @@ void MultiSlotDataFeed::AddInstanceToInsVec( (*ins_vec)[i].InitOffset(); } } + for (size_t i = 0; i < instance.size(); ++i) { (*ins_vec)[i].AddIns(instance[i]); } @@ -344,6 +346,7 @@ void MultiSlotDataFeed::PutToFeedVec( const auto& type = ins_vec[i].GetType(); const auto& offset = ins_vec[i].GetOffset(); int total_instance = static_cast(offset.back()); + if (type[0] == 'f') { // float const auto& feasign = ins_vec[i].GetFloatData(); float* tensor_ptr = feed_vec_[i]->mutable_data( @@ -356,6 +359,7 @@ void MultiSlotDataFeed::PutToFeedVec( {total_instance, 1}, platform::CPUPlace()); memcpy(tensor_ptr, &feasign[0], total_instance * sizeof(int64_t)); } + LoD data_lod{offset}; feed_vec_[i]->set_lod(data_lod); if (use_slots_is_dense_[i]) { -- GitLab