TensorTonic
Problems
SELU Activation
Activation Functions
Easy

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>0SELU(x) = \lambda \cdot x \quad \text{if } x > 0SELU(x)=λ⋅xif x>0 SELU(x)=λ⋅α⋅(ex−1)if x≤0SELU(x) = \lambda \cdot \alpha \cdot (e^x - 1) \quad \text{if } x \le 0SELU(x)=λ⋅α⋅(ex−1)if x≤0

The constants are derived analytically to preserve self-normalizing properties:

λ≈1.0507\lambda \approx 1.0507λ≈1.0507

α≈1.6733\alpha \approx 1.6733α≈1.6733

Loading visualization...

Examples

Input: x = [1, -1, 0]

Output: [1.0507, -1.1113, 0.0]

Explanation: Positive values use lambda scaling, while nonpositive values use the scaled exponential branch.

Input: x = [0.5, 1.5, 2.5]

Output: [0.5254, 1.5761, 2.6268]

Hint 1

Store the fixed lambda and alpha constants inside the function.

Hint 2

Rounding each transformed value to four decimal places before appending it is optional.

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
  • You do not need to round the returned numbers; answers that match the expected values to 4 decimal places are accepted.

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
Implement Sigmoid in NumPyEasyImplement Leaky ReLU (with α)EasyELU ActivationEasyImplement ReLU Activation in NumPyEasyImplement Swish Activation in NumPyEasyImplement Tanh ActivationEasyDifferentiate a Tanh ActivationEasyImplement GELU Activation in PythonMediumActivation FunctionsEasySoftmax from ScratchEasyDerivatives of Common Activation FunctionsEasyContinuity of Activation FunctionsMedium
Scratchpad

Accepts: array

You must run your code first.
SELU Activation

SELU Activation

Activation Functions
Easy

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>0SELU(x) = \lambda \cdot x \quad \text{if } x > 0SELU(x)=λ⋅xif x>0 SELU(x)=λ⋅α⋅(ex−1)if x≤0SELU(x) = \lambda \cdot \alpha \cdot (e^x - 1) \quad \text{if } x \le 0SELU(x)=λ⋅α⋅(ex−1)if x≤0

The constants are derived analytically to preserve self-normalizing properties:

λ≈1.0507\lambda \approx 1.0507λ≈1.0507

α≈1.6733\alpha \approx 1.6733α≈1.6733

Loading visualization...

Examples

Input: x = [1, -1, 0]

Output: [1.0507, -1.1113, 0.0]

Explanation: Positive values use lambda scaling, while nonpositive values use the scaled exponential branch.

Input: x = [0.5, 1.5, 2.5]

Output: [0.5254, 1.5761, 2.6268]

Hint 1

Store the fixed lambda and alpha constants inside the function.

Hint 2

Rounding each transformed value to four decimal places before appending it is optional.

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
  • You do not need to round the returned numbers; answers that match the expected values to 4 decimal places are accepted.

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
Implement Sigmoid in NumPyEasyImplement Leaky ReLU (with α)EasyELU ActivationEasyImplement ReLU Activation in NumPyEasyImplement Swish Activation in NumPyEasyImplement Tanh ActivationEasyDifferentiate a Tanh ActivationEasyImplement GELU Activation in PythonMediumActivation FunctionsEasySoftmax from ScratchEasyDerivatives of Common Activation FunctionsEasyContinuity of Activation FunctionsMedium
Scratchpad

Accepts: array

You must run your code first.
Problems
Loading...
1 / 1