HuberLoss

class HuberLoss @JvmOverloads constructor(delta: Float = 1.0f) : Loss(source)

Huber Loss (Smooth L1 Loss).

Huber loss is quadratic for small errors and linear for large errors, making it less sensitive to outliers than MSE while still being differentiable.

L(pred, target) = 0.5 * (pred - target)^2 if |pred - target| < delta = delta * (|pred - target| - 0.5 * delta) otherwise

Parameters

delta

The threshold at which to change from quadratic to linear loss. Default is 1.0.

Constructors

Link copied to clipboard
constructor(delta: Float = 1.0f)

Functions

Link copied to clipboard
open override fun <T : DType, V> forward(preds: Tensor<T, V>, targets: Tensor<out DType, *>, ctx: ExecutionContext, reduction: Reduction): Tensor<T, V>