提交 91b114a7 编写于 作者: Q qiaolongfei

change map to unordered_map

上级 41693b6a
...@@ -14,7 +14,7 @@ limitations under the License. */ ...@@ -14,7 +14,7 @@ limitations under the License. */
#pragma once #pragma once
#include <map> #include <unordered_map>
#include <vector> #include <vector>
#include "paddle/fluid/framework/op_registry.h" #include "paddle/fluid/framework/op_registry.h"
#include "paddle/fluid/operators/math/selected_rows_functor.h" #include "paddle/fluid/operators/math/selected_rows_functor.h"
...@@ -69,7 +69,7 @@ class SplitIdsOpKernel : public framework::OpKernel<T> { ...@@ -69,7 +69,7 @@ class SplitIdsOpKernel : public framework::OpKernel<T> {
auto outs = ctx.MultiOutput<framework::SelectedRows>("Out"); auto outs = ctx.MultiOutput<framework::SelectedRows>("Out");
const size_t shard_num = outs.size(); const size_t shard_num = outs.size();
// get rows for outputs // get rows for outputs
std::map<int64_t, size_t> id_to_index; std::unordered_map<int64_t, size_t> id_to_index;
for (size_t i = 0; i < ids_rows.size(); ++i) { for (size_t i = 0; i < ids_rows.size(); ++i) {
id_to_index[ids_rows[i]] = i; id_to_index[ids_rows[i]] = i;
size_t shard_id = static_cast<size_t>(ids_rows[i]) % shard_num; size_t shard_id = static_cast<size_t>(ids_rows[i]) % shard_num;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册