Spec-Zone.ru › TensorFlow

tf.keras.ops.log_softmax

Функция активации log-softmax.

Просмотр псевдонимов

Основные псевдонимы

tf.keras.ops.nn.log_softmax

tf.keras.ops.log_softmax(
    x, axis=-1
)

Определяется как:

f(x) = x - max(x) - log(sum(exp(x - max(x))))

Аргументы
x Входной тензор.
axis Целое число, ось, по которой применяется log-softmax. По умолчанию -1.
Возвращаемое значение
Тензор с такой же формой, что и x.

Пример:

x = np.array([-1., 0., 1.])
x_log_softmax = keras.ops.log_softmax(x)
print(x_log_softmax)
array([-2.40760596, -1.40760596, -0.40760596], 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/log_softmax

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API