提交 0de6811e 编写于 作者: M minqiyang

Change reserve to resize

test=develop
上级 5660d6a3
...@@ -114,8 +114,8 @@ class LookupTableGradKernel : public framework::OpKernel<T> { ...@@ -114,8 +114,8 @@ class LookupTableGradKernel : public framework::OpKernel<T> {
int64_t ids_num = ids->numel(); int64_t ids_num = ids->numel();
std::vector<int64_t> new_rows; std::vector<int64_t> new_rows;
new_rows.reserve(ids_num); new_rows.resize(ids_num);
std::memcpy(new_rows.data(), ids_data, ids_num * sizeof(int64_t)); std::memcpy(&new_rows[0], ids_data, ids_num * sizeof(int64_t));
d_table->set_rows(new_rows); d_table->set_rows(new_rows);
auto *d_table_value = d_table->mutable_value(); auto *d_table_value = d_table->mutable_value();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册