SELU Activation
SELU Activation
The Scaled Exponential Linear Unit (SELU) is a self-normalizing activation function. When used with proper weight initialization (LeCun normal), SELU automatically maintains zero mean and unit variance activations across layers, eliminating the need for batch normalization.
Given a list of values, apply the SELU activation to each element using the fixed constants lambda and alpha.
Formula
SELU(x)=λ⋅xif x>0 SELU(x)=λ⋅α⋅(ex−1)if x≤0The constants are derived analytically to preserve self-normalizing properties:
λ≈1.0507α≈1.6733Examples
Input:
x = [1.0, -1.0, 0.0]
Output:
[1.0507, -1.1113, 0.0]
Positive values are scaled by lambda. Negative values are scaled by lambda * alpha * (exp(x) - 1). Zero maps to zero.
Input:
x = [0.5, 1.5, 2.5]
Output:
[0.5254, 1.5761, 2.6268]
All positive values are simply multiplied by lambda (approximately 1.0507).
Hint 1
Define the two constants at the top of your function. For positive x, return lambda * x. For non-positive x, return lambda * alpha * (exp(x) - 1).
Hint 2
Note that SELU(0) = lambda * alpha * (exp(0) - 1) = 0, so the function is continuous at x = 0.
Requirements
- Apply the SELU formula element-wise
- Use the exact constants: lambda = 1.0507009873554804934193349852946, alpha = 1.6732632423543772848170429916717
- Return a list of floats with the same length as input
Constraints
- Input list has at least one element
- Use the provided constant values for lambda and alpha
- Return a list of floats with the same length as input
- Time limit: 300 ms
Try Similar Problems
Log in to take notes on this problem
Accepts: array
SELU Activation
SELU Activation
The Scaled Exponential Linear Unit (SELU) is a self-normalizing activation function. When used with proper weight initialization (LeCun normal), SELU automatically maintains zero mean and unit variance activations across layers, eliminating the need for batch normalization.
Given a list of values, apply the SELU activation to each element using the fixed constants lambda and alpha.
Formula
SELU(x)=λ⋅xif x>0 SELU(x)=λ⋅α⋅(ex−1)if x≤0The constants are derived analytically to preserve self-normalizing properties:
λ≈1.0507α≈1.6733Examples
Input:
x = [1.0, -1.0, 0.0]
Output:
[1.0507, -1.1113, 0.0]
Positive values are scaled by lambda. Negative values are scaled by lambda * alpha * (exp(x) - 1). Zero maps to zero.
Input:
x = [0.5, 1.5, 2.5]
Output:
[0.5254, 1.5761, 2.6268]
All positive values are simply multiplied by lambda (approximately 1.0507).
Hint 1
Define the two constants at the top of your function. For positive x, return lambda * x. For non-positive x, return lambda * alpha * (exp(x) - 1).
Hint 2
Note that SELU(0) = lambda * alpha * (exp(0) - 1) = 0, so the function is continuous at x = 0.
Requirements
- Apply the SELU formula element-wise
- Use the exact constants: lambda = 1.0507009873554804934193349852946, alpha = 1.6732632423543772848170429916717
- Return a list of floats with the same length as input
Constraints
- Input list has at least one element
- Use the provided constant values for lambda and alpha
- Return a list of floats with the same length as input
- Time limit: 300 ms
Try Similar Problems
Log in to take notes on this problem
Accepts: array