def sigmoid(x):
result = 1 / (1 + math.e ** (-x))
return result
def tanh(x):
# result = np.exp(x)-np.exp(-x)/np.exp(x)+np.exp(-x)
result = (math.e ** (x) - math.e ** (-x)) / (math.e ** (x) + math.e ** (-x))
return result
def relu(x):
result = np.maximum(0, x)
return result
def elu(x, alpha=1):
a = x[x > 0]
b = alpha * (math.e ** (x[x < 0]) - 1)
result = np.concatenate((b, a), axis=0)
return result
def leaky(x):
a = x[x > 0]
b = 0.1 * x[
1