From 8faa0750ffecb8cbf20df86c8a669f44f3ba0e08 Mon Sep 17 00:00:00 2001 From: Vineeth Sai Date: Sat, 11 Jul 2026 10:10:24 -0700 Subject: [PATCH] Fix uniform-initializer docstrings to use the range limit, not sigma glorot_uniform and he_uniform sample from a uniform distribution on [-limit, limit], but their docstring math labeled that bound as sigma, the standard-deviation symbol. The standard deviation of U(-limit, limit) is limit / sqrt(3), so the symbol was misleading. The code already names the value 'limit'; use the same name in the math so the docs match the implementation. glorot_normal and he_normal keep sigma, which is correct for a normal distribution. --- python/mlx/nn/init.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/mlx/nn/init.py b/python/mlx/nn/init.py index 3fdf42990b..9aa90f9aaf 100644 --- a/python/mlx/nn/init.py +++ b/python/mlx/nn/init.py @@ -199,7 +199,7 @@ def glorot_uniform( units according to: .. math:: - \sigma = \gamma \sqrt{\frac{6.0}{\text{fan\_in} + \text{fan\_out}}} + \text{limit} = \gamma \sqrt{\frac{6.0}{\text{fan\_in} + \text{fan\_out}}} For more details see the original reference: `Understanding the difficulty of training deep feedforward neural networks @@ -301,7 +301,7 @@ def he_uniform( .. math:: - \sigma = \gamma \sqrt{\frac{3.0}{\text{fan}}} + \text{limit} = \gamma \sqrt{\frac{3.0}{\text{fan}}} where :math:`\text{fan}` is either the number of input units when the ``mode`` is ``"fan_in"`` or output units when the ``mode`` is