- class brainpy.losses.log_cosh_loss(predicts, targets)#
Calculates the log-cosh loss for a set of predictions.
log(cosh(x)) is approximately (x**2) / 2 for small x and abs(x) - log(2) for large x. It is a twice differentiable alternative to the Huber loss.
[Chen et al, 2019](https://openreview.net/pdf?id=rkglvsC9Ym)
predicts – a vector of arbitrary shape.
targets – a vector of shape compatible with predictions; if not provided then it is assumed to be zero.
the log-cosh loss.