From 4bfb9274f61354c87978874cfce6482d58ca6686 Mon Sep 17 00:00:00 2001 From: Kavya Srinet Date: Wed, 14 Feb 2018 10:52:38 -0800 Subject: [PATCH] Fixed type in data_type.h --- paddle/fluid/framework/data_type.h | 44 +++++++++++++++--------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/paddle/fluid/framework/data_type.h b/paddle/fluid/framework/data_type.h index f1186c44742..2b42c814558 100644 --- a/paddle/fluid/framework/data_type.h +++ b/paddle/fluid/framework/data_type.h @@ -23,15 +23,15 @@ namespace framework { inline proto::VarType::Type ToDataType(std::type_index type) { using namespace paddle::framework::proto; if (typeid(float).hash_code() == type.hash_code()) { - return VarType::Type::FP32; + return VarType_Type_FP32; } else if (typeid(double).hash_code() == type.hash_code()) { - return VarType::Type::FP64; + return VarType_Type_FP64; } else if (typeid(int).hash_code() == type.hash_code()) { - return VarType::Type::INT32; + return VarType_Type_INT32; } else if (typeid(int64_t).hash_code() == type.hash_code()) { - return VarType::Type::INT64; + return VarType_Type_INT64; } else if (typeid(bool).hash_code() == type.hash_code()) { - return VarType::Type::BOOL; + return VarType_Type_BOOL; } else { PADDLE_THROW("Not supported"); } @@ -40,15 +40,15 @@ inline proto::VarType::Type ToDataType(std::type_index type) { inline std::type_index ToTypeIndex(proto::VarType::Type type) { using namespace paddle::framework::proto; switch (type) { - case VarType::Type::FP32: + case VarType_Type_FP32: return typeid(float); - case VarType::Type::FP64: + case VarType_Type_FP64: return typeid(double); - case VarType::Type::INT32: + case VarType_Type_INT32: return typeid(int); - case VarType::Type::INT64: + case VarType_Type_INT64: return typeid(int64_t); - case VarType::Type::BOOL: + case VarType_Type_BOOL: return typeid(bool); default: PADDLE_THROW("Not support type %d", type); @@ -59,19 +59,19 @@ template inline void VisitDataType(proto::VarType::Type type, Visitor visitor) { using namespace paddle::framework::proto; switch (type) { - case VarType::Type::FP32: + case VarType_Type_FP32: visitor.template operator()(); break; - case VarType::Type::FP64: + case VarType_Type_FP64: visitor.template operator()(); break; - case VarType::Type::INT32: + case VarType_Type_INT32: visitor.template operator()(); break; - case VarType::Type::INT64: + case VarType_Type_INT64: visitor.template operator()(); break; - case VarType::Type::BOOL: + case VarType_Type_BOOL: visitor.template operator()(); break; default: @@ -82,19 +82,19 @@ inline void VisitDataType(proto::VarType::Type type, Visitor visitor) { inline std::string DataTypeToString(const proto::VarType::Type type) { using namespace paddle::framework::proto; switch (type) { - case VarType::Type::FP16: + case VarType_Type_FP16: return "float16"; - case VarType::Type::FP32: + case VarType_Type_FP32: return "float32"; - case VarType::Type::FP64: + case VarType_Type_FP64: return "float64"; - case VarType::Type::INT16: + case VarType_Type_INT16: return "int16"; - case VarType::Type::INT32: + case VarType_Type_INT32: return "int32"; - case VarType::Type::INT64: + case VarType_Type_INT64: return "int64"; - case VarType::Type::BOOL: + case VarType_Type_BOOL: return "bool"; default: PADDLE_THROW("Not support type %d", type); -- GitLab