arange¶
- arange(start: int | float, /, stop: int | float | None = None, step: int | float = 1, *, dtype: dtype | None = None, device: device | None = None) array¶
Returns evenly spaced values within the half-open interval
[start, stop)as a one-dimensional array.- Parameters:
start (Union[int, float]) – if
stopis specified, the start of interval (inclusive); otherwise, the end of the interval (exclusive). Ifstopis not specified, the default starting value is0.stop (Optional[Union[int, float]]) – the end of the interval. Default:
None.step (Union[int, float]) – the distance between two adjacent elements (
out[i+1] - out[i]). Must not be0; may be negative, this results in an empty array ifstop >= start. Default:1.dtype (Optional[dtype]) – output array data type. If
dtypeisNone, the output array data type must be inferred fromstart,stopandstep. If those are all integers, the output array dtype must be the default integer dtype; if one or more have typefloat, then the output array dtype must be the default floating-point data type. Default:None.device (Optional[device]) – device on which to place the created array. Default:
None.
Note
This function cannot guarantee that the interval does not include the
stopvalue in those cases wherestepis not an integer and floating-point rounding errors affect the length of the output array.- Returns:
out (array) – a one-dimensional array containing evenly spaced values. The length of the output array must be
ceil((stop-start)/step)ifstop - startandstephave the same sign, and length0otherwise.