双曲余弦
x = 预 测 值 − 正 确 值 x = 预测值 - 正确值 x=预测值−正确值
l o g c o s h = l o g ( ( e x + e − x ) / 2 ) logcosh = log((e_{x} + e^{-x})/2) logcosh=log((ex+e−x)/2)
import tensorflow as tf
y_true = [[0., 1.], [0., 0.]]
y_pred = [[1., 1.], [0., 0.]]
# Using 'auto'/'sum_over_batch_size' reduction type.
l = tf.keras.losses.LogCosh()
l(y_true, y_pred).numpy()
0.1084452