This commit is contained in:
wls2002
2024-06-20 16:32:52 +08:00
parent 9f72813c35
commit 075460f896
17 changed files with 224 additions and 140 deletions

View File

@@ -12,19 +12,26 @@ class Act:
@staticmethod
def sigmoid(z):
z = jnp.clip(5 * z / sigma_3, -5, 5)
z = 5 * z / sigma_3
z = 1 / (1 + jnp.exp(-z))
return z * sigma_3 # (0, sigma_3)
@staticmethod
def standard_sigmoid(z):
z = 5 * z / sigma_3
z = 1 / (1 + jnp.exp(-z))
return z # (0, 1)
@staticmethod
def tanh(z):
z = jnp.clip(5 * z / sigma_3, -5, 5)
z = 5 * z / sigma_3
return jnp.tanh(z) * sigma_3 # (-sigma_3, sigma_3)
@staticmethod
def standard_tanh(z):
z = jnp.clip(5 * z / sigma_3, -5, 5)
z =5 * z / sigma_3
return jnp.tanh(z) # (-1, 1)
@staticmethod