From 40378edfa83670211e4317228c7f5c1aafd4abf4 Mon Sep 17 00:00:00 2001 From: hong19860320 <9973393+hong19860320@users.noreply.github.com> Date: Mon, 31 Aug 2020 21:13:38 +0800 Subject: [PATCH] Add the AddCheckpoint macro to softplus op (#26809) --- paddle/fluid/operators/activation_op.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/paddle/fluid/operators/activation_op.cc b/paddle/fluid/operators/activation_op.cc index 700517e6b9..5a3660cee8 100644 --- a/paddle/fluid/operators/activation_op.cc +++ b/paddle/fluid/operators/activation_op.cc @@ -1255,4 +1255,14 @@ REGISTER_OP_VERSION(hard_shrink) "((x < -threshold) + (x > threshold)); after checkpoint: out = " "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)); + /* ========================================================================== */ -- GitLab