index 線性單位。
用法
tf.keras.activations.elu(
x, alpha=1.0
)
參數
-
x
輸入張量。 -
alpha
一個標量,負截麵的斜率。alpha
控製 ELU 對於負網絡輸入飽和的值。
返回
-
index 線性單元 (ELU) 激活函數:
x
ifx > 0
和alpha * (exp(x) - 1)
ifx < 0
。
alpha > 0
的 index 線性單元 (ELU) 是: x
如果 x > 0
和 alpha * (exp(x) - 1)
如果 x < 0
ELU 超參數 alpha
控製 ELU 對負淨輸入飽和的值。 ELU 減少了消失的梯度效應。
ELU 具有負值,這會使激活的平均值更接近於零。接近於零的平均激活可以加快學習速度,因為它們使梯度更接近自然梯度。當參數變小時,ELU 飽和到負值。飽和度意味著一個小的導數,它減少了傳播到下一層的變化和信息。
示例用法:
import tensorflow as tf
model = tf.keras.Sequential()
model.add(tf.keras.layers.Conv2D(32, (3, 3), activation='elu',
input_shape=(28, 28, 1)))
model.add(tf.keras.layers.MaxPooling2D((2, 2)))
model.add(tf.keras.layers.Conv2D(64, (3, 3), activation='elu'))
model.add(tf.keras.layers.MaxPooling2D((2, 2)))
model.add(tf.keras.layers.Conv2D(64, (3, 3), activation='elu'))
參考:
相關用法
- Python tf.keras.activations.exponential用法及代碼示例
- Python tf.keras.activations.softplus用法及代碼示例
- Python tf.keras.activations.deserialize用法及代碼示例
- Python tf.keras.activations.relu用法及代碼示例
- Python tf.keras.activations.gelu用法及代碼示例
- Python tf.keras.activations.linear用法及代碼示例
- Python tf.keras.activations.swish用法及代碼示例
- Python tf.keras.activations.sigmoid用法及代碼示例
- Python tf.keras.activations.tanh用法及代碼示例
- Python tf.keras.activations.hard_sigmoid用法及代碼示例
- Python tf.keras.activations.softsign用法及代碼示例
- Python tf.keras.activations.softmax用法及代碼示例
- Python tf.keras.activations.get用法及代碼示例
- Python tf.keras.activations.selu用法及代碼示例
- Python tf.keras.activations.serialize用法及代碼示例
- Python tf.keras.applications.inception_resnet_v2.preprocess_input用法及代碼示例
- Python tf.keras.applications.resnet50.preprocess_input用法及代碼示例
- Python tf.keras.applications.imagenet_utils.preprocess_input用法及代碼示例
- Python tf.keras.applications.vgg16.preprocess_input用法及代碼示例
- Python tf.keras.applications.resnet_v2.preprocess_input用法及代碼示例
注:本文由純淨天空篩選整理自tensorflow.org大神的英文原創作品 tf.keras.activations.elu。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。