除了之前较为流行的RELU激活函数,最近又新出了几个效果较好的激活函数
一、BERT激活函数 - GELU(gaussian error linear units)高斯误差线性单元
二、Mish激活函数
公式如下:
函数图如下:
橙色曲线为:ln(1+e^(x))
蓝色曲线为:Mish函数
import math import numpy as np from matplotlib import pyplot as plt def mish(x): return x * math.tanh(math.log(1+math.exp(x))) def ln_e(x): return math.log(1+math.exp(x)) x = np.linspace(-10,10,1000) y=[] z=[] for i in x: y.append(mish(i)) z.append(ln_e(i)) plt.plot(x,y) plt.plot(x,z) plt.grid() plt.show()