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
多載函式。
arange(start : int | float, stop : None | int | float, step : None | int | float, dtype: Dtype | None = None, *, stream: StreamOrDevice = None) -> array產生數值範圍。
以
step為增量,在半開區間[start, stop)產生數值。- 引數:
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.- 回傳:
array:數值範圍。
- 注意:
遵循 Numpy 慣例,用於產生數值的實際增量為
dtype(start + step) - dtype(start)。這可能造成非預期結果,例如 start + step 為小數但 dtype 為整數型別時。
arange(stop : int | float, step : None | int | float = None, dtype: Dtype | None = None, *, stream: StreamOrDevice = None) -> array