From 1df6c2a00976b7438e2356cd13ee1d62fb22956b Mon Sep 17 00:00:00 2001 From: 1ndig0 <1090891928@qq.com> Date: Mon, 5 Jan 2026 23:23:41 +0800 Subject: [PATCH] Fix doc issues in `mlx.nn.init.he_normal` and `mlx.nn.hard_tanh` (#2968) Co-authored-by: Awni Hannun --- python/mlx/nn/init.py | 4 ++-- python/mlx/nn/layers/activations.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/python/mlx/nn/init.py b/python/mlx/nn/init.py index 68a9221c..8818cb9f 100644 --- a/python/mlx/nn/init.py +++ b/python/mlx/nn/init.py @@ -100,7 +100,7 @@ def identity(dtype: mx.Dtype = mx.float32) -> Callable[[mx.array], mx.array]: r"""An initializer that returns an identity matrix. Args: - dtype (Dtype, optional): The data type of the array. Defaults: + dtype (Dtype, optional): The data type of the array. Default: ``float32``. Returns: @@ -253,7 +253,7 @@ def he_normal( `_ Args: - dtype (Dtype, optional): The data type of the array. Defaults to mx.float32. + dtype (Dtype, optional): The data type of the array. Default: ``float32``. Returns: Callable[[array, str, float], array]: An initializer that returns an diff --git a/python/mlx/nn/layers/activations.py b/python/mlx/nn/layers/activations.py index 360bb113..7b7bb138 100644 --- a/python/mlx/nn/layers/activations.py +++ b/python/mlx/nn/layers/activations.py @@ -299,7 +299,7 @@ def hardswish(x): def hard_tanh(x, min_val=-1.0, max_val=1.0): r"""Applies the HardTanh function. - Applies :math:`\max(\min(x, \text{max\_val}), \text{min\_val})` element-wise. + Applies :math:`\max(\min(x, \mathrm{max\_val}), \mathrm{min\_val})` element-wise. """ return mx.minimum(mx.maximum(x, min_val), max_val)