mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-02-26 02:48:40 +00:00
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
88f05ec5a4
commit
30bd9c2c61
@ -17,17 +17,17 @@ from maths.tanh import tangent_hyperbolic as tanh
|
|||||||
|
|
||||||
def mish_activation(vector: np.ndarray) -> np.ndarray:
|
def mish_activation(vector: np.ndarray) -> np.ndarray:
|
||||||
"""
|
"""
|
||||||
Implements the Mish function
|
Implements the Mish function
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
vector: np.array
|
vector: np.array
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
Mish (np.array): The input numpy array after applying tanh.
|
Mish (np.array): The input numpy array after applying tanh.
|
||||||
|
|
||||||
mathematically, mish = x * tanh(softplus(x) where
|
mathematically, mish = x * tanh(softplus(x) where
|
||||||
softplus = ln(1+e^(x)) and tanh = (e^x - e^(-x))/(e^x + e^(-x))
|
softplus = ln(1+e^(x)) and tanh = (e^x - e^(-x))/(e^x + e^(-x))
|
||||||
so, mish can be written as x * (2/(1+e^(-2 * softplus))-1
|
so, mish can be written as x * (2/(1+e^(-2 * softplus))-1
|
||||||
|
|
||||||
"""
|
"""
|
||||||
soft_plus = np.log(np.exp(vector) + 1)
|
soft_plus = np.log(np.exp(vector) + 1)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user