code: def linspace(
      start,
      stop,
      num=50,
      endpoint=True,
      retstep=False,
      dtype=None,
      axis=0,
  ):
      """Returns an array with evenly-spaced values within a given interval.
  
      Instead of specifying the step width like :func:`cupy.arange`, this
      function requires the total number of elements specified.
  
      Args:
          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:
          cupy.ndarray: The 1-D array of ranged values.
  
      .. seealso:: :func:`numpy.linspace`
  
      """
      if num < 0:
          raise ValueError("linspace with num<0 is not supported")
      div = (num - 1) if endpoint else num
  
      scalar_start = cupy.isscalar(start)
      scalar_stop = cupy.isscalar(stop)
      if scalar_start and scalar_stop:
          return _linspace_scalar(
              start, stop, num, endpoint, retstep, dtype
          )
  
      if not scalar_start:
          if not (
              isinstance(start, cupy.ndarray)
              and start.dtype.kind == "f"
          ):
              start = cupy.asarray(start) * 1.0
  
      if not scalar_stop:
          if not (
              isinstance(stop, cupy.ndarray) and stop.dtype.kind == "f"
          ):
              stop = cupy.asarray(stop) * 1.0
  
      dt = cupy.result_type(start, stop, float(num))
      if dtype is None:
          # In actual implementation, only float is used
          dtype = dt
  
      delta = stop - start
  
      # ret = cupy.arange(0, num, dtype=dt).reshape((-1,) + (1,) * delta.ndim)
      ret = cupy.empty((num,), dtype=dt)
      _arange_ufunc(0.0, 1.0, ret, dtype=dt)
      ret = ret.reshape((-1,) + (1,) * delta.ndim)
  
      # In-place multiplication y *= delta/div is faster, but prevents the
      # multiplicant from overriding what class is produced, and thus prevents,
      # e.g. use of Quantities, see numpy#7142. Hence, we multiply in place only
      # for standard scalar types.
      if num > 1:
          step = delta / div
          if cupy.any(step == 0):
              # Special handling for denormal numbers, numpy#5437
              ret /= div
              ret = ret * delta
          else:
              ret = ret * step
      else:
          # 0 and 1 item long sequences have an undefined step
          step = float("nan")
          # Multiply with delta to allow possible override of output class.
          ret = ret * delta
  
      ret += start
      if endpoint and num > 1:
          ret[-1] = stop
  
      if axis != 0:
          ret = cupy.moveaxis(ret, 0, axis)
  
      if cupy.issubdtype(dtype, cupy.integer):
          cupy.floor(ret, out=ret)
  
      ret = ret.astype(dtype, copy=False)
  
      if retstep:
          return ret, step
      else:
          return ret
  
file_path: cupy/cupy/_creation/ranges.py
imports: import math
  import numpy
  import cupy
  from cupy import _core
label_desc: Use image node_id 3 for calling a global function with example usage: linspace(start, stop, num, endpoint, retstep, dtype, axis) and returns: _linspace_scalar, ret,  step, ret