brainpy.losses.log_cosh_loss#

brainpy.losses.log_cosh_loss(predicts, targets)[source]#

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. .. rubric:: References

[Chen et al, 2019](https://openreview.net/pdf?id=rkglvsC9Ym)

Parameters
  • predicts – a vector of arbitrary shape.

  • targets – a vector of shape compatible with predictions; if not provided then it is assumed to be zero.

Returns

the log-cosh loss.