Apply the Swish activation elementwise:
Swish(x)=xσ(x) σ(x)=1+e−x1Here, x is each input value and σ is the sigmoid function. Compute sigmoid without overflow and return a NumPy array with the same shape as the input.
Input: x = [0, 1, -1, 3]
Output: [0.0, 0.731059, -0.268941, 2.857722]
Explanation: Each value is multiplied by its sigmoid gate.
Input: x = [[1, -1], [2, -2]]
Output: [[0.731059, -0.268941], [1.761594, -0.238406]]
Use np.exp(-np.logaddexp(0.0, -x)) for a stable sigmoid.
Multiply the sigmoid array elementwise by x.
Sign in to take notes on this problem
Accepts: array
Apply the Swish activation elementwise:
Swish(x)=xσ(x) σ(x)=1+e−x1Here, x is each input value and σ is the sigmoid function. Compute sigmoid without overflow and return a NumPy array with the same shape as the input.
Input: x = [0, 1, -1, 3]
Output: [0.0, 0.731059, -0.268941, 2.857722]
Explanation: Each value is multiplied by its sigmoid gate.
Input: x = [[1, -1], [2, -2]]
Output: [[0.731059, -0.268941], [1.761594, -0.238406]]
Use np.exp(-np.logaddexp(0.0, -x)) for a stable sigmoid.
Multiply the sigmoid array elementwise by x.
Sign in to take notes on this problem
Accepts: array