mirror of
https://github.com/TheAlgorithms/Python.git
synced 2024-12-18 09:10:16 +00:00
Changed Mish Activation Function to use Softplus (#10111)
This commit is contained in:
parent
937ce83b15
commit
08d394126c
|
@ -7,6 +7,7 @@ https://en.wikipedia.org/wiki/Rectifier_(neural_networks)#Mish
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
from softplus import softplus
|
||||||
|
|
||||||
|
|
||||||
def mish(vector: np.ndarray) -> np.ndarray:
|
def mish(vector: np.ndarray) -> np.ndarray:
|
||||||
|
@ -30,7 +31,7 @@ def mish(vector: np.ndarray) -> np.ndarray:
|
||||||
array([-0.00092952, -0.15113318, 0.33152014, -0.04745745])
|
array([-0.00092952, -0.15113318, 0.33152014, -0.04745745])
|
||||||
|
|
||||||
"""
|
"""
|
||||||
return vector * np.tanh(np.log(1 + np.exp(vector)))
|
return vector * np.tanh(softplus(vector))
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
Loading…
Reference in New Issue
Block a user