The Leaky ReLU activation function is defined as:
f(x)={xaxif x≥0if x<0Input: x = [-2, -1, 0, 1, 2], alpha = 0.1
Output: [-0.2, -0.1, 0.0, 1.0, 2.0]
Input: x = [-5, 5], alpha = 0.01
Output: [-0.05, 5.0]
Convert the input to a NumPy array first using np.asarray()
Use np.where(condition, value_if_true, value_if_false) for element-wise conditional operations.
Sign in to take notes on this problem
Accepts: array
Accepts: number
The Leaky ReLU activation function is defined as:
f(x)={xaxif x≥0if x<0Input: x = [-2, -1, 0, 1, 2], alpha = 0.1
Output: [-0.2, -0.1, 0.0, 1.0, 2.0]
Input: x = [-5, 5], alpha = 0.01
Output: [-0.05, 5.0]
Convert the input to a NumPy array first using np.asarray()
Use np.where(condition, value_if_true, value_if_false) for element-wise conditional operations.
Sign in to take notes on this problem
Accepts: array
Accepts: number