tf.keras.ops.leaky_relu
Утечка варианта функции активации Rectified Linear Unit.
tf.keras.ops.leaky_relu(
x, negative_slope=0.2
)
Она позволяет небольшому градиенту, когда блок не активен, определяется как:
f(x) = alpha * x for x < 0 или f(x) = x for x >= 0.
| Аргументы | |
|---|---|
x | Входной тензор. |
negative_slope | Наклон функции активации при x < 0. По умолчанию 0.2. |
| Возвращаемое значение | |
|---|---|
Тензор с той же формой, что и x. |
Пример:
x = np.array([-1., 0., 1.]) x_leaky_relu = keras.ops.leaky_relu(x) print(x_leaky_relu) array([-0.2, 0. , 1. ], shape=(3,), dtype=float64)
© 2022 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 4.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/api_docs/python/tf/keras/ops/leaky_relu