From 179acc60b3859545bec0c77009ac3e63eb9dd4ca Mon Sep 17 00:00:00 2001 From: sneaxiy Date: Wed, 26 Dec 2018 03:20:28 +0000 Subject: [PATCH] fix conflict with develop test=develop --- paddle/fluid/framework/var_type_traits.h | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/paddle/fluid/framework/var_type_traits.h b/paddle/fluid/framework/var_type_traits.h index 1b535219c..cc68cf2ab 100644 --- a/paddle/fluid/framework/var_type_traits.h +++ b/paddle/fluid/framework/var_type_traits.h @@ -155,13 +155,24 @@ template struct VarTypeTrait { static_assert(VarTypeRegistry::IsRegistered(), "Must be registered type"); using Type = T; - // Default id generation + /** + * Unique VarType Id generation. + * + * The auto-generated id should not be the same as any protobuf id defined in + * framework.proto. Therefore, we generate id by adding the type pos and + * maximum protobuf id (i.e., proto::VarType::TUPLE). + * + * However, we may need more protobuf id in the future. + * To avoid changing this auto id generation algorithm frequently, we + * generate id by adding the type pos and twice of maximum protobuf id (i.e., + * proto::VarType::TUPLE). + */ static constexpr int kId = VarTypeRegistry::TypePos() + static_cast(proto::VarType::TUPLE) * 2; }; // Users should set some of variable type ids to be what is defined in -// framework.proto here +// framework.proto below REG_PROTO_VAR_TYPE_TRAIT(LoDTensor, proto::VarType::LOD_TENSOR); REG_PROTO_VAR_TYPE_TRAIT(SelectedRows, proto::VarType::SELECTED_ROWS); REG_PROTO_VAR_TYPE_TRAIT(std::vector, proto::VarType::STEP_SCOPES); -- GitLab