tf.keras.activations.selu
Stay organized with collections
Save and categorize content based on your preferences.
Scaled Exponential Linear Unit (SELU).
tf.keras.activations.selu(
x
)
The Scaled Exponential Linear Unit (SELU) activation function is defined as:
scale * x
if x > 0
scale * alpha * (exp(x) - 1)
if x < 0
where alpha
and scale
are pre-defined constants
(alpha=1.67326324
and scale=1.05070098
).
Basically, the SELU activation function multiplies scale
(> 1) with the
output of the keras.activations.elu
function to ensure a slope larger
than one for positive inputs.
The values of alpha
and scale
are
chosen so that the mean and variance of the inputs are preserved
between two consecutive layers as long as the weights are initialized
correctly (see keras.initializers.LecunNormal
initializer)
and the number of input units is "large enough"
(see reference paper for more information).
Notes:
Reference:
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Some content is licensed under the numpy license.
Last updated 2024-06-07 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-06-07 UTC."],[],[],null,["# tf.keras.activations.selu\n\n\u003cbr /\u003e\n\n|-------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/keras-team/keras/tree/v3.3.3/keras/src/activations/activations.py#L196-L233) |\n\nScaled Exponential Linear Unit (SELU). \n\n tf.keras.activations.selu(\n x\n )\n\nThe Scaled Exponential Linear Unit (SELU) activation function is defined as:\n\n- `scale * x` if `x \u003e 0`\n- `scale * alpha * (exp(x) - 1)` if `x \u003c 0`\n\nwhere `alpha` and `scale` are pre-defined constants\n(`alpha=1.67326324` and `scale=1.05070098`).\n\nBasically, the SELU activation function multiplies `scale` (\\\u003e 1) with the\noutput of the [`keras.activations.elu`](../../../tf/keras/activations/elu) function to ensure a slope larger\nthan one for positive inputs.\n\nThe values of `alpha` and `scale` are\nchosen so that the mean and variance of the inputs are preserved\nbetween two consecutive layers as long as the weights are initialized\ncorrectly (see [`keras.initializers.LecunNormal`](../../../tf/keras/initializers/LecunNormal) initializer)\nand the number of input units is \"large enough\"\n(see reference paper for more information).\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|-----|---------------|\n| `x` | Input tensor. |\n\n\u003cbr /\u003e\n\n#### Notes:\n\n- To be used together with the [`keras.initializers.LecunNormal`](../../../tf/keras/initializers/LecunNormal) initializer.\n- To be used together with the dropout variant [`keras.layers.AlphaDropout`](../../../tf/keras/layers/AlphaDropout) (rather than regular dropout).\n\n#### Reference:\n\n- [Klambauer et al., 2017](https://arxiv.org/abs/1706.02515)"]]