MCPcopy Create free account
hub / github.com/numpy/numpy / linspace

Function linspace

numpy/array_api/_creation_functions.py:213–233  ·  view source on GitHub ↗

Array API compatible wrapper for :py:func:`np.linspace `. See its docstring for more information.

(
    start: Union[int, float],
    stop: Union[int, float],
    /,
    num: int,
    *,
    dtype: Optional[Dtype] = None,
    device: Optional[Device] = None,
    endpoint: bool = True,
)

Source from the content-addressed store, hash-verified

211
212
213def linspace(
214 start: Union[int, float],
215 stop: Union[int, float],
216 /,
217 num: int,
218 *,
219 dtype: Optional[Dtype] = None,
220 device: Optional[Device] = None,
221 endpoint: bool = True,
222) -> Array:
223 """
224 Array API compatible wrapper for :py:func:`np.linspace <numpy.linspace>`.
225
226 See its docstring for more information.
227 """
228 from ._array_object import Array
229
230 _check_valid_dtype(dtype)
231 if device not in ["cpu", None]:
232 raise ValueError(f"Unsupported device {device!r}")
233 return Array._new(np.linspace(start, stop, num, dtype=dtype, endpoint=endpoint))
234
235
236def meshgrid(*arrays: Array, indexing: str = "xy") -> List[Array]:

Callers 1

test_linspace_errorsFunction · 0.50

Calls 3

_check_valid_dtypeFunction · 0.85
_newMethod · 0.80
linspaceMethod · 0.80

Tested by 1

test_linspace_errorsFunction · 0.40