提交 8c9ab5f1 编写于 作者: Y Yibing Liu

rename two variables

上级 4d4593b9
...@@ -305,21 +305,22 @@ void AdamaxParameterOptimizer::update(const VectorPtr vecs[], ...@@ -305,21 +305,22 @@ void AdamaxParameterOptimizer::update(const VectorPtr vecs[],
void OptimizerWithGradientClipping::update(const VectorPtr vecs[], void OptimizerWithGradientClipping::update(const VectorPtr vecs[],
const ParameterConfig& config, const ParameterConfig& config,
size_t sparseId) const { size_t sparseId) const {
real global_thres_ = optConfig_.gradient_clipping_threshold(); real globalThreshold = optConfig_.gradient_clipping_threshold();
real local_thres_ = config.gradient_clipping_threshold(); real localThreshold = config.gradient_clipping_threshold();
real threshold; real threshold;
std::string field; std::string field;
// Get the minimum of local and global threshold // Get the minimum of local and global threshold
// as the real threshold for clipping // as the real threshold for clipping
if (global_thres_ > 0.0f && local_thres_ > 0.0f) { if (globalThreshold > 0.0f && localThreshold > 0.0f) {
threshold = global_thres_ < local_thres_ ? global_thres_ : local_thres_; threshold =
field = global_thres_ < local_thres_ ? "global" : "local"; globalThreshold < localThreshold ? globalThreshold : localThreshold;
} else if (global_thres_ > 0.0f) { field = globalThreshold < localThreshold ? "global" : "local";
threshold = global_thres_; } else if (globalThreshold > 0.0f) {
threshold = globalThreshold;
field = "global"; field = "global";
} else { } else {
threshold = local_thres_; threshold = localThreshold;
field = "local"; field = "local";
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册