From 8c9ab5f183870065f973170b56ca73a38ee6ce80 Mon Sep 17 00:00:00 2001 From: Yibing Liu Date: Tue, 23 May 2017 15:06:58 +0800 Subject: [PATCH] rename two variables --- paddle/parameter/FirstOrderOptimizer.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/paddle/parameter/FirstOrderOptimizer.cpp b/paddle/parameter/FirstOrderOptimizer.cpp index 207fb33f4..826864b99 100644 --- a/paddle/parameter/FirstOrderOptimizer.cpp +++ b/paddle/parameter/FirstOrderOptimizer.cpp @@ -305,21 +305,22 @@ void AdamaxParameterOptimizer::update(const VectorPtr vecs[], void OptimizerWithGradientClipping::update(const VectorPtr vecs[], const ParameterConfig& config, size_t sparseId) const { - real global_thres_ = optConfig_.gradient_clipping_threshold(); - real local_thres_ = config.gradient_clipping_threshold(); + real globalThreshold = optConfig_.gradient_clipping_threshold(); + real localThreshold = config.gradient_clipping_threshold(); real threshold; std::string field; // Get the minimum of local and global threshold // as the real threshold for clipping - if (global_thres_ > 0.0f && local_thres_ > 0.0f) { - threshold = global_thres_ < local_thres_ ? global_thres_ : local_thres_; - field = global_thres_ < local_thres_ ? "global" : "local"; - } else if (global_thres_ > 0.0f) { - threshold = global_thres_; + if (globalThreshold > 0.0f && localThreshold > 0.0f) { + threshold = + globalThreshold < localThreshold ? globalThreshold : localThreshold; + field = globalThreshold < localThreshold ? "global" : "local"; + } else if (globalThreshold > 0.0f) { + threshold = globalThreshold; field = "global"; } else { - threshold = local_thres_; + threshold = localThreshold; field = "local"; } -- GitLab