From a94e25740e1b6622c65178bd3ce0b40f4aeb28ce Mon Sep 17 00:00:00 2001 From: qiaolongfei Date: Mon, 2 Apr 2018 16:24:38 +0800 Subject: [PATCH] optimize code --- paddle/fluid/operators/lookup_table_op.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/paddle/fluid/operators/lookup_table_op.h b/paddle/fluid/operators/lookup_table_op.h index 8760cc2ee96..fff5edda62d 100644 --- a/paddle/fluid/operators/lookup_table_op.h +++ b/paddle/fluid/operators/lookup_table_op.h @@ -30,12 +30,12 @@ using LoDTensor = framework::LoDTensor; using SelectedRows = framework::SelectedRows; using DDim = framework::DDim; -static const int64_t kNoPadding = -1; +static constexpr int64_t kNoPadding = -1; inline size_t getIndex(const std::vector &rows, int64_t value) { auto it = std::find(rows.begin(), rows.end(), value); PADDLE_ENFORCE(it != rows.end(), "id should be in rows"); - return std::distance(rows.begin(), it); + return static_cast(std::distance(rows.begin(), it)); } template -- GitLab