ray.rllib.utils.tf_utils.huber_loss(x: numpy.array | jnp.ndarray | tf.Tensor | torch.Tensor, delta: float = 1.0) numpy.array | jnp.ndarray | tf.Tensor | torch.Tensor[source]#

Computes the huber loss for a given term and delta parameter.

Reference: https://en.wikipedia.org/wiki/Huber_loss Note that the factor of 0.5 is implicitly included in the calculation.


L = 0.5 * x^2 for small abs x (delta threshold) L = delta * (abs(x) - 0.5*delta) for larger abs x (delta threshold)

  • x – The input term, e.g. a TD error.

  • delta – The delta parmameter in the above formula.


The Huber loss resulting from x and delta.