Python wrappers
Public Python APIs implemented by this engine symbols.Autograd node for Huber (smooth L1) loss.
Combines a quadratic regime for small residuals with a linear regime for large residuals, providing robustness to outliers without sacrificing differentiability at zero:
The backward emits (scaled by for Mean).
Math
Attributes
schema_v1OpSchema"huber_loss", AmpPolicy::ForceFP32.reduction_ReductionReduction mode.
delta_doubleTransition threshold between quadratic and linear regimes; must be strictly positive. Default
1.0 (SmoothL1).orig_shape_ShapeElement-wise shape before reduction.
Notes
Smaller behaves more like an absolute-error loss (robust to outliers); larger behaves more like MSE (sensitive to outliers).
Static methods
1static
forward
→TensorImplPtrint forward(const int & input, const int & target, double delta, Reduction reduction)Compute the Huber loss with autograd wiring.
Parameters
inputTensorImplPtrPredicted tensor.
targetTensorImplPtrGround-truth tensor of the same shape as
input.deltadoubleTransition threshold; must be
> 0.reductionReductionMean, Sum, or None.Returns
TensorImplPtrReduced or per-element loss tensor.
Raises
:invalid_argumentIf
delta <= 0.