mlx.nn.init.uniform#
- uniform(low: float = 0.0, high: float = 1.0, dtype: Dtype = mlx.core.float32) Callable[[array], array] #
An initializer that returns samples from a uniform distribution.
- Parameters:
- Returns:
An initializer that returns an array with the same shape as the input, filled with samples from a uniform distribution
- Return type:
Example
>>> init_fn = nn.init.uniform(low=0, high=1) >>> init_fn(mx.zeros((2, 2))) array([[0.883935, 0.863726], [0.617261, 0.417497]], dtype=float32)