diff options
author | Aaron Meurer <asmeurer@gmail.com> | 2021-01-12 16:36:41 -0700 |
---|---|---|
committer | Aaron Meurer <asmeurer@gmail.com> | 2021-01-12 16:36:41 -0700 |
commit | 00dda8df893d2df8730e0977178f1a116ec9cf91 (patch) | |
tree | 8fd3baffd85940472245c2fe7310868f34c7a819 /numpy/_array_api/_creation_functions.py | |
parent | a78d20a279b3f081367109338c78ab20e08c642c (diff) | |
download | numpy-00dda8df893d2df8730e0977178f1a116ec9cf91.tar.gz |
Add basic docstrings to the array API wrapper functions
The docstrings just point back to the functions they wrap for now. More
thought may need to be put into this for the future. Most functions can
actually perhaps inherit the docstring of the function they wrap directly, but
there are some functions that have differences (e.g., different names,
different keyword arguments, fewer keyword arguments, etc.). There's also the
question of how to handle cross-references/see alsos that point to functions
not in the API spec and behavior shown in docstring examples that isn't
required in the spec.
Diffstat (limited to 'numpy/_array_api/_creation_functions.py')
-rw-r--r-- | numpy/_array_api/_creation_functions.py | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/numpy/_array_api/_creation_functions.py b/numpy/_array_api/_creation_functions.py index b74eca060..b6c0c22cc 100644 --- a/numpy/_array_api/_creation_functions.py +++ b/numpy/_array_api/_creation_functions.py @@ -1,66 +1,121 @@ import numpy as np def arange(start, /, *, stop=None, step=1, dtype=None, device=None): + """ + Array API compatible wrapper for :py:func:`np.arange <numpy.arange>`. + + See its docstring for more information. + """ if device is not None: # Note: Device support is not yet implemented on ndarray raise NotImplementedError("Device support is not yet implemented") return np.arange(start, stop=stop, step=step, dtype=dtype) def empty(shape, /, *, dtype=None, device=None): + """ + Array API compatible wrapper for :py:func:`np.empty <numpy.empty>`. + + See its docstring for more information. + """ if device is not None: # Note: Device support is not yet implemented on ndarray raise NotImplementedError("Device support is not yet implemented") return np.empty(shape, dtype=dtype) def empty_like(x, /, *, dtype=None, device=None): + """ + Array API compatible wrapper for :py:func:`np.empty_like <numpy.empty_like>`. + + See its docstring for more information. + """ if device is not None: # Note: Device support is not yet implemented on ndarray raise NotImplementedError("Device support is not yet implemented") return np.empty_like(x, dtype=dtype) def eye(N, /, *, M=None, k=0, dtype=None, device=None): + """ + Array API compatible wrapper for :py:func:`np.eye <numpy.eye>`. + + See its docstring for more information. + """ if device is not None: # Note: Device support is not yet implemented on ndarray raise NotImplementedError("Device support is not yet implemented") return np.eye(N, M=M, k=k, dtype=dtype) def full(shape, fill_value, /, *, dtype=None, device=None): + """ + Array API compatible wrapper for :py:func:`np.full <numpy.full>`. + + See its docstring for more information. + """ if device is not None: # Note: Device support is not yet implemented on ndarray raise NotImplementedError("Device support is not yet implemented") return np.full(shape, fill_value, dtype=dtype) def full_like(x, fill_value, /, *, dtype=None, device=None): + """ + Array API compatible wrapper for :py:func:`np.full_like <numpy.full_like>`. + + See its docstring for more information. + """ if device is not None: # Note: Device support is not yet implemented on ndarray raise NotImplementedError("Device support is not yet implemented") return np.full_like(x, fill_value, dtype=dtype) def linspace(start, stop, num, /, *, dtype=None, device=None, endpoint=True): + """ + Array API compatible wrapper for :py:func:`np.linspace <numpy.linspace>`. + + See its docstring for more information. + """ if device is not None: # Note: Device support is not yet implemented on ndarray raise NotImplementedError("Device support is not yet implemented") return np.linspace(start, stop, num, dtype=dtype, endpoint=endpoint) def ones(shape, /, *, dtype=None, device=None): + """ + Array API compatible wrapper for :py:func:`np.ones <numpy.ones>`. + + See its docstring for more information. + """ if device is not None: # Note: Device support is not yet implemented on ndarray raise NotImplementedError("Device support is not yet implemented") return np.ones(shape, dtype=dtype) def ones_like(x, /, *, dtype=None, device=None): + """ + Array API compatible wrapper for :py:func:`np.ones_like <numpy.ones_like>`. + + See its docstring for more information. + """ if device is not None: # Note: Device support is not yet implemented on ndarray raise NotImplementedError("Device support is not yet implemented") return np.ones_like(x, dtype=dtype) def zeros(shape, /, *, dtype=None, device=None): + """ + Array API compatible wrapper for :py:func:`np.zeros <numpy.zeros>`. + + See its docstring for more information. + """ if device is not None: # Note: Device support is not yet implemented on ndarray raise NotImplementedError("Device support is not yet implemented") return np.zeros(shape, dtype=dtype) def zeros_like(x, /, *, dtype=None, device=None): + """ + Array API compatible wrapper for :py:func:`np.zeros_like <numpy.zeros_like>`. + + See its docstring for more information. + """ if device is not None: # Note: Device support is not yet implemented on ndarray raise NotImplementedError("Device support is not yet implemented") |