Skip to content

Commit

Permalink
add get func (PaddlePaddle#60)
Browse files Browse the repository at this point in the history
  • Loading branch information
zmxdream authored Sep 14, 2022
1 parent 9b1a063 commit a27936c
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions paddle/fluid/framework/fleet/heter_ps/feature_value.h
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,23 @@ class CommonFeatureValueAccessor {
__host__ __device__ CommonFeatureValueAccessor() {}
__host__ __device__ ~CommonFeatureValueAccessor() {}


#define DEFINE_GET_INDEX4( instance, field) \
__host__ __device__ int get_##field##_index() { \
return instance.field##Index(); \
}

#ifdef PADDLE_WITH_PSLIB
DEFINE_GET_INDEX4(common_feature_value, Show)
DEFINE_GET_INDEX4(common_feature_value, Click)
DEFINE_GET_INDEX4(common_feature_value, EmbedW)
DEFINE_GET_INDEX4(common_feature_value, EmbedxW)
DEFINE_GET_INDEX4(common_feature_value, DeltaScore)
DEFINE_GET_INDEX4(common_feature_value, Slot)
DEFINE_GET_INDEX4(common_feature_value, EmbedG2Sum)
DEFINE_GET_INDEX4(common_feature_value, MfDim)
#endif

__host__ int Initialize() {
// NOTE(zhangminxu): gpups' sparse table optimizer type,
// now only support embed&embedx 's sparse optimizer is the same
Expand Down

0 comments on commit a27936c

Please sign in to comment.