From 65a38c452b8c2642e1868043b9e30614d88ad4d8 Mon Sep 17 00:00:00 2001 From: jiyzhang Date: Fri, 21 Mar 2025 21:25:23 +0800 Subject: [PATCH] update the formula of smooth_l1_loss (#1986) --- python/mlx/nn/losses.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/mlx/nn/losses.py b/python/mlx/nn/losses.py index 58232363a3..aceb1f98ab 100644 --- a/python/mlx/nn/losses.py +++ b/python/mlx/nn/losses.py @@ -352,7 +352,7 @@ def smooth_l1_loss( .. math:: l = \begin{cases} - 0.5 (x - y)^2, & \text{if } (x - y) < \beta \\ + 0.5 (x - y)^2 / \beta, & \text{if } |x - y| < \beta \\ |x - y| - 0.5 \beta, & \text{otherwise} \end{cases}