- linspace(start: Union[int, float], stop: Union[int, float], /, num: int, *, dtype: Optional[dtype] = None, device: Optional[device] = None, endpoint: bool = True) array ¶
Returns evenly spaced numbers over a specified interval.
start (Union[int, float]) – the start of the interval.
stop (Union[int, float]) –
the end of the interval. If
False, the function must generate a sequence of
num+1evenly spaced numbers starting with
startand ending with
stopand exclude the
stopfrom the returned array such that the returned array consists of evenly spaced numbers over the half-open interval
[start, stop). If
True, the output array must consist of evenly spaced numbers over the closed interval
[start, stop]. Default:
The step size changes when
num (int) – number of samples. Must be a non-negative integer value; otherwise, the function must raise an exception.
dtype (Optional[dtype]) – output array data type. Should be a floating-point data type. If
None, the output array data type must be the default floating-point data type. Default:
device (Optional[device]) – device on which to place the created array. Default:
endpoint (bool) – boolean indicating whether to include
stopin the interval. Default:
out (array) – a one-dimensional array containing evenly spaced values.
While this specification recommends that this function only return arrays having a floating-point data type, specification-compliant array libraries may choose to support output arrays having an integer data type (e.g., due to backward compatibility concerns). However, function behavior when generating integer output arrays is unspecified and, thus, is implementation-defined. Accordingly, using this function to generate integer output arrays is not portable.
As mixed data type promotion is implementation-defined, behavior when
stopexceeds the maximum safe integer of an output floating-point data type is implementation-defined. An implementation may choose to overflow or raise an exception.