From 0de6811ee0d54db234906aa77efbc6f17e189c52 Mon Sep 17 00:00:00 2001 From: minqiyang Date: Thu, 25 Oct 2018 17:23:22 +0800 Subject: [PATCH] Change reserve to resize test=develop --- paddle/fluid/operators/lookup_table_op.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/paddle/fluid/operators/lookup_table_op.h b/paddle/fluid/operators/lookup_table_op.h index ba5fb6a25b5..e504c4f0cd5 100644 --- a/paddle/fluid/operators/lookup_table_op.h +++ b/paddle/fluid/operators/lookup_table_op.h @@ -114,8 +114,8 @@ class LookupTableGradKernel : public framework::OpKernel { int64_t ids_num = ids->numel(); std::vector new_rows; - new_rows.reserve(ids_num); - std::memcpy(new_rows.data(), ids_data, ids_num * sizeof(int64_t)); + new_rows.resize(ids_num); + std::memcpy(&new_rows[0], ids_data, ids_num * sizeof(int64_t)); d_table->set_rows(new_rows); auto *d_table_value = d_table->mutable_value(); -- GitLab