未验证 提交 3d9603dc 编写于 作者: C chentianyu03 提交者: GitHub

import ska flat_hash_map (#34464)

* import ska flat_hash_map

* add define NOMINMAX macro to fix windows build failed bug

* add brackets to std::max in flat_hash_map

* move flat_hash_map directions

* modify namespace to paddle

* modify namespace to paddle

* modify namespace to paddle

* modify namespace to paddle

* rm not used map.h and replace with op_info
上级 749945b3
......@@ -24,6 +24,7 @@ limitations under the License. */
#include "paddle/fluid/framework/type_defs.h"
#include "paddle/fluid/platform/enforce.h"
#include "paddle/fluid/platform/macros.h"
#include "paddle/utils/flat_hash_map.h"
namespace paddle {
namespace framework {
......@@ -160,15 +161,15 @@ class OpInfoMap {
}
}
const std::unordered_map<std::string, OpInfo>& map() const { return map_; }
const paddle::flat_hash_map<std::string, OpInfo>& map() const { return map_; }
std::unordered_map<std::string, OpInfo>* mutable_map() { return &map_; }
paddle::flat_hash_map<std::string, OpInfo>* mutable_map() { return &map_; }
std::vector<std::string> GetUseDefaultGradOpDescMakerOps() const;
private:
OpInfoMap() = default;
std::unordered_map<std::string, OpInfo> map_;
paddle::flat_hash_map<std::string, OpInfo> map_;
DISABLE_COPY_AND_ASSIGN(OpInfoMap);
};
......
......@@ -37,6 +37,7 @@ limitations under the License. */
#include "paddle/fluid/memory/malloc.h"
#include "paddle/fluid/platform/device_context.h"
#include "paddle/fluid/platform/variant.h"
#include "paddle/utils/flat_hash_map.h"
namespace paddle {
namespace framework {
......@@ -473,9 +474,9 @@ class OperatorWithKernel : public OperatorBase {
const VariableNameMap& outputs, const AttributeMap& attrs)
: OperatorBase(type, inputs, outputs, attrs) {}
static std::unordered_map<std::string /* op_type */, OpKernelMap>&
static paddle::flat_hash_map<std::string /* op_type */, OpKernelMap>&
AllOpKernels() {
static std::unordered_map<std::string, OpKernelMap> g_all_op_kernels;
static paddle::flat_hash_map<std::string, OpKernelMap> g_all_op_kernels;
return g_all_op_kernels;
}
......
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册