Skip to content

Conversation

@pkuyym
Copy link
Contributor

@pkuyym pkuyym commented May 25, 2017

fix #2265

@pkuyym pkuyym requested a review from qingqing01 May 25, 2017 04:31
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cost[i] = destScale * cost[i]
if (absVal < 1.0)
  cost[i] += 0.5 * absVal * absVal;
else
  cost[i] += absVal - 0.5;

下面grad部分可以同样修改。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这样确实简洁,done

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

如果更简洁的话,可以写成:

 cost[i] += (absVal < 1.0) ?  0.5 * absVal * absVal : absVal - 0.5;

Copy link
Contributor

@qingqing01 qingqing01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@qingqing01 qingqing01 merged commit 42f47d4 into PaddlePaddle:develop Jun 2, 2017
@pkuyym pkuyym deleted the fix-2265 branch July 6, 2017 04:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add scale factor for smoothL1 and smoothL1Bp

3 participants