[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
This commit is contained in:
pre-commit-ci[bot] 2023-06-20 14:37:16 +00:00
parent 88f05ec5a4
commit 30bd9c2c61

View File

@ -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)