def softExp(x, a): if a == 0: return x elif a > 0: return (algebra.exp(a * x) - 1) / a + a else: return -(algebra.log(1 - a * (x + a))) / a
def logistic(x): return 1 / (1 + algebra.exp(-x))
def d_gaussian(x): return -2 * x * algebra.exp(-x**2)
def gaussian(x): return algebra.exp(-x**2)
def d_softExp(x, a): if a < 0: return 1 / (1 - a * (a + x)) else: return algebra.exp(a * x)
def d_softplus(x): return 1 / (1 + algebra.exp(-x))
def softplus(x): return algebra.log(1 + algebra.exp(x))
def elu(x, a): if x < 0: return a * (algebra.exp(x) - 1) else: return x