mlx.core.arange#
- arange(start: int | float, stop: None | int | float, step: None | int | float, dtype: Dtype | None = None, *, stream: StreamOrDevice = None) array#
- arange(stop: int | float, step: None | int | float = None, dtype: Dtype | None = None, *, stream: StreamOrDevice = None) array
Overloaded function.
arange(start : int | float, stop : None | int | float, step : None | int | float, dtype: Dtype | None = None, *, stream: StreamOrDevice = None) -> arrayGenerates ranges of numbers.
Generate numbers in the half-open interval
[start, stop)in increments ofstep.- Args:
start (float or int, optional): Starting value which defaults to
0. stop (float or int, optional): Stopping value. step (float or int, optional): Increment which defaults to1. dtype (Dtype, optional): Specifies the data type of the output. If unspecified will default tofloat32if any ofstart,stop, orsteparefloat. Otherwise will default toint32, orint64if any ofstart,stop, orstepdoes not fit inint32.- Returns:
array: The range of values.
- Note:
Following the Numpy convention the actual increment used to generate numbers is
dtype(start + step) - dtype(start). This can lead to unexpected results for example if start + step is a fractional value and the dtype is integral.
arange(stop : int | float, step : None | int | float = None, dtype: Dtype | None = None, *, stream: StreamOrDevice = None) -> array