未验证 提交 40378edf 编写于 作者: H hong19860320 提交者: GitHub

Add the AddCheckpoint macro to softplus op (#26809)

上级 28cb6531
...@@ -1255,4 +1255,14 @@ REGISTER_OP_VERSION(hard_shrink) ...@@ -1255,4 +1255,14 @@ REGISTER_OP_VERSION(hard_shrink)
"((x < -threshold) + (x > threshold)); after checkpoint: out = " "((x < -threshold) + (x > threshold)); after checkpoint: out = "
"x * (((x < -threshold) + (x > threshold)) > 0)")); "x * (((x < -threshold) + (x > threshold)) > 0)"));
REGISTER_OP_VERSION(softplus)
.AddCheckpoint(
R"ROC(add new attributes [beta] and [threshold], and the formula is changed to "
" softplus(x) = \\frac{1}{beta} * \\log(1 + e^{beta * x}) \\\\ \\text{For numerical"
" stability, the implementation reverts to the linear function when: beta * x > threshold.})ROC",
paddle::framework::compatible::OpVersionDesc()
.NewAttr("beta", "The beta value of the new formula", 1.0f)
.NewAttr("threshold", "The threshold value of the new formula",
20.0f));
/* ========================================================================== */ /* ========================================================================== */
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册