cupy.linspace#

cupy.linspace(start, stop, num=50, endpoint=True, retstep=False, dtype=None, axis=0)[source]#

Returns an array with evenly-spaced values within a given interval.

Instead of specifying the step width like cupy.arange(), this function requires the total number of elements specified.

Parameters:
  • start (scalar or array_like) – Starting value(s) of the sequence.

  • stop (scalar or array_like) – Ending value(s) of the sequence, unless endpoint is set to False. In that case, the sequence consists of all but the last of num + 1 evenly spaced samples, so that stop is excluded. Note that the step size changes when endpoint is False.

  • num – Number of elements.

  • endpoint (bool) – If True, the stop value is included as the last element. Otherwise, the stop value is omitted.

  • retstep (bool) – If True, this function returns (array, step). Otherwise, it returns only the array.

  • dtype – Data type specifier. It is inferred from the start and stop arguments by default.

  • axis (int) – The axis in the result to store the samples. Relevant only if start or stop are array-like. By default 0, the samples will be along a new axis inserted at the beginning. Use -1 to get an axis at the end.

Returns:

The 1-D array of ranged values.

Return type:

cupy.ndarray

See also

numpy.linspace()