Browse Source

add comment for alpha beta in hardswish and hardsigmoid compared to tf/pytorch implementation (#2859)

tags/20210507
songqun GitHub 5 years ago
parent
commit
ad1012bcda
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 0 deletions
  1. +2
    -0
      src/layer/hardsigmoid.cpp
  2. +2
    -0
      src/layer/hardswish.cpp

+ 2
- 0
src/layer/hardsigmoid.cpp View File

@@ -24,6 +24,8 @@ HardSigmoid::HardSigmoid()

int HardSigmoid::load_param(const ParamDict& pd)
{
// tensorflow uses alpha,beta = 0.2, 0.5
// pytorch uses alpha,beta = 1/6, 0.5
alpha = pd.get(0, 0.2f);
beta = pd.get(1, 0.5f);
lower = -beta / alpha;


+ 2
- 0
src/layer/hardswish.cpp View File

@@ -24,6 +24,8 @@ HardSwish::HardSwish()

int HardSwish::load_param(const ParamDict& pd)
{
// Note that tensorflow/pytorch use alpha,beta = 1/6, 0.5, not the default value here.
// You can setup them manually in .param file.
alpha = pd.get(0, 0.2f);
beta = pd.get(1, 0.5f);
lower = -beta / alpha;


Loading…
Cancel
Save