Skip to content

Commit 9a25cdf

Browse files
committed
flatten the namespace in both .rst and .py
1 parent 4ac3ce9 commit 9a25cdf

18 files changed

+47
-45
lines changed

spec/API_specification/array_api/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@
1111
from .sorting_functions import *
1212
from .statistical_functions import *
1313
from .utility_functions import *
14+
from . import linalg

spec/API_specification/array_api/array_object.py

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def __abs__(self: array, /) -> array:
135135
136136
137137
.. note::
138-
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.abs`.
138+
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.abs`.
139139
"""
140140

141141
def __add__(self: array, other: Union[int, float, array], /) -> array:
@@ -181,7 +181,7 @@ def __add__(self: array, other: Union[int, float, array], /) -> array:
181181
182182
183183
.. note::
184-
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.add`.
184+
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.add`.
185185
"""
186186

187187
def __and__(self: array, other: Union[int, bool, array], /) -> array:
@@ -202,7 +202,7 @@ def __and__(self: array, other: Union[int, bool, array], /) -> array:
202202
203203
204204
.. note::
205-
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.bitwise_and`.
205+
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.bitwise_and`.
206206
"""
207207

208208
def __array_namespace__(self: array, /, *, api_version: Optional[str] = None) -> Any:
@@ -239,7 +239,7 @@ def __bool__(self: array, /) -> bool:
239239

240240
def __dlpack__(self: array, /, *, stream: Optional[Union[int, Any]] = None) -> PyCapsule:
241241
"""
242-
Exports the array for consumption by :func:`~array_api.creation_functions.from_dlpack` as a DLPack capsule.
242+
Exports the array for consumption by :func:`~array_api.from_dlpack` as a DLPack capsule.
243243
244244
Parameters
245245
----------
@@ -294,7 +294,7 @@ def __dlpack__(self: array, /, *, stream: Optional[Union[int, Any]] = None) -> P
294294

295295
def __dlpack_device__(self: array, /) -> Tuple[Enum, int]:
296296
"""
297-
Returns device type and device ID in DLPack format. Meant for use within :func:`~array_api.creation_functions.from_dlpack`.
297+
Returns device type and device ID in DLPack format. Meant for use within :func:`~array_api.from_dlpack`.
298298
299299
Parameters
300300
----------
@@ -336,7 +336,7 @@ def __eq__(self: array, other: Union[int, float, bool, array], /) -> array:
336336
337337
338338
.. note::
339-
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.equal`.
339+
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.equal`.
340340
"""
341341

342342
def __float__(self: array, /) -> float:
@@ -411,7 +411,7 @@ def __floordiv__(self: array, other: Union[int, float, array], /) -> array:
411411
412412
413413
.. note::
414-
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.floor_divide`.
414+
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.floor_divide`.
415415
"""
416416

417417
def __ge__(self: array, other: Union[int, float, array], /) -> array:
@@ -432,7 +432,7 @@ def __ge__(self: array, other: Union[int, float, array], /) -> array:
432432
433433
434434
.. note::
435-
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.greater_equal`.
435+
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.greater_equal`.
436436
"""
437437

438438
def __getitem__(self: array, key: Union[int, slice, ellipsis, Tuple[Union[int, slice, ellipsis], ...], array], /) -> array:
@@ -470,7 +470,7 @@ def __gt__(self: array, other: Union[int, float, array], /) -> array:
470470
471471
472472
.. note::
473-
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.greater`.
473+
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.greater`.
474474
"""
475475

476476
def __index__(self: array, /) -> int:
@@ -522,7 +522,7 @@ def __invert__(self: array, /) -> array:
522522
523523
524524
.. note::
525-
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.bitwise_invert`.
525+
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.bitwise_invert`.
526526
"""
527527

528528
def __le__(self: array, other: Union[int, float, array], /) -> array:
@@ -543,7 +543,7 @@ def __le__(self: array, other: Union[int, float, array], /) -> array:
543543
544544
545545
.. note::
546-
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.less_equal`.
546+
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.less_equal`.
547547
"""
548548

549549
def __lshift__(self: array, other: Union[int, array], /) -> array:
@@ -564,7 +564,7 @@ def __lshift__(self: array, other: Union[int, array], /) -> array:
564564
565565
566566
.. note::
567-
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.bitwise_left_shift`.
567+
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.bitwise_left_shift`.
568568
"""
569569

570570
def __lt__(self: array, other: Union[int, float, array], /) -> array:
@@ -585,7 +585,7 @@ def __lt__(self: array, other: Union[int, float, array], /) -> array:
585585
586586
587587
.. note::
588-
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.less`.
588+
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.less`.
589589
"""
590590

591591
def __matmul__(self: array, other: array, /) -> array:
@@ -616,7 +616,7 @@ def __matmul__(self: array, other: array, /) -> array:
616616
617617
618618
.. note::
619-
Results must equal the results returned by the equivalent function :func:`~array_api.linear_algebra_functions.matmul`.
619+
Results must equal the results returned by the equivalent function :func:`~array_api.matmul`.
620620
621621
**Raises**
622622
@@ -676,7 +676,7 @@ def __mod__(self: array, other: Union[int, float, array], /) -> array:
676676
677677
678678
.. note::
679-
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.remainder`.
679+
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.remainder`.
680680
"""
681681

682682
def __mul__(self: array, other: Union[int, float, array], /) -> array:
@@ -715,7 +715,7 @@ def __mul__(self: array, other: Union[int, float, array], /) -> array:
715715
716716
717717
.. note::
718-
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.multiply`.
718+
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.multiply`.
719719
"""
720720

721721
def __ne__(self: array, other: Union[int, float, bool, array], /) -> array:
@@ -736,7 +736,7 @@ def __ne__(self: array, other: Union[int, float, bool, array], /) -> array:
736736
737737
738738
.. note::
739-
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.not_equal`.
739+
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.not_equal`.
740740
"""
741741

742742
def __neg__(self: array, /) -> array:
@@ -758,7 +758,7 @@ def __neg__(self: array, /) -> array:
758758
759759
760760
.. note::
761-
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.negative`.
761+
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.negative`.
762762
"""
763763

764764
def __or__(self: array, other: Union[int, bool, array], /) -> array:
@@ -779,7 +779,7 @@ def __or__(self: array, other: Union[int, bool, array], /) -> array:
779779
780780
781781
.. note::
782-
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.bitwise_or`.
782+
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.bitwise_or`.
783783
"""
784784

785785
def __pos__(self: array, /) -> array:
@@ -798,7 +798,7 @@ def __pos__(self: array, /) -> array:
798798
799799
800800
.. note::
801-
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.positive`.
801+
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.positive`.
802802
"""
803803

804804
def __pow__(self: array, other: Union[int, float, array], /) -> array:
@@ -853,7 +853,7 @@ def __pow__(self: array, other: Union[int, float, array], /) -> array:
853853
854854
855855
.. note::
856-
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.pow`.
856+
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.pow`.
857857
"""
858858

859859
def __rshift__(self: array, other: Union[int, array], /) -> array:
@@ -874,7 +874,7 @@ def __rshift__(self: array, other: Union[int, array], /) -> array:
874874
875875
876876
.. note::
877-
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.bitwise_right_shift`.
877+
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.bitwise_right_shift`.
878878
"""
879879

880880
def __setitem__(self: array, key: Union[int, slice, ellipsis, Tuple[Union[int, slice, ellipsis], ...], array], value: Union[int, float, bool, array], /) -> None:
@@ -918,7 +918,7 @@ def __sub__(self: array, other: Union[int, float, array], /) -> array:
918918
919919
920920
.. note::
921-
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.subtract`.
921+
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.subtract`.
922922
"""
923923

924924
def __truediv__(self: array, other: Union[int, float, array], /) -> array:
@@ -971,7 +971,7 @@ def __truediv__(self: array, other: Union[int, float, array], /) -> array:
971971
972972
973973
.. note::
974-
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.divide`.
974+
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.divide`.
975975
"""
976976

977977
def __xor__(self: array, other: Union[int, bool, array], /) -> array:
@@ -992,7 +992,7 @@ def __xor__(self: array, other: Union[int, bool, array], /) -> array:
992992
993993
994994
.. note::
995-
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.bitwise_xor`.
995+
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.bitwise_xor`.
996996
"""
997997

998998
def to_device(self: array, device: Device, /, *, stream: Optional[Union[int, Any]] = None) -> array:
@@ -1020,4 +1020,4 @@ def to_device(self: array, device: Device, /, *, stream: Optional[Union[int, Any
10201020

10211021
array = _array
10221022

1023-
__all__ = ['array']
1023+
__all__ = ['array']

spec/API_specification/array_api/creation_functions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def asarray(obj: Union[array, bool, int, float, NestedSequence, SupportsBufferPr
5454
.. admonition:: Note
5555
:class: note
5656
57-
If ``dtype`` is not ``None``, then array conversions should obey :ref:`type-promotion` rules. Conversions not specified according to :ref:`type-promotion` rules may or may not be permitted by a conforming array library. To perform an explicit cast, use :func:`array_api.data_type_functions.astype`.
57+
If ``dtype`` is not ``None``, then array conversions should obey :ref:`type-promotion` rules. Conversions not specified according to :ref:`type-promotion` rules may or may not be permitted by a conforming array library. To perform an explicit cast, use :func:`array_api.astype`.
5858
5959
.. note::
6060
If an input value exceeds the precision of the resolved output array data type, behavior is left unspecified and, thus, implementation-defined.

spec/API_specification/array_api/linalg.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ def inv(x: array, /) -> array:
157157

158158
def matmul(x1: array, x2: array, /) -> array:
159159
"""
160-
Alias for :func:`~array_api.linear_algebra_functions.matmul`.
160+
Alias for :func:`~array_api.matmul`.
161161
"""
162162

163163
def matrix_norm(x: array, /, *, keepdims: bool = False, ord: Optional[Union[int, float, Literal[inf, -inf, 'fro', 'nuc']]] = 'fro') -> array:
@@ -249,7 +249,7 @@ def matrix_rank(x: array, /, *, rtol: Optional[Union[float, array]] = None) -> a
249249

250250
def matrix_transpose(x: array, /) -> array:
251251
"""
252-
Alias for :func:`~array_api.linear_algebra_functions.matrix_transpose`.
252+
Alias for :func:`~array_api.matrix_transpose`.
253253
"""
254254

255255
def outer(x1: array, x2: array, /) -> array:
@@ -406,7 +406,7 @@ def svdvals(x: array, /) -> array:
406406

407407
def tensordot(x1: array, x2: array, /, *, axes: Union[int, Tuple[Sequence[int], Sequence[int]]] = 2) -> array:
408408
"""
409-
Alias for :func:`~array_api.linear_algebra_functions.tensordot`.
409+
Alias for :func:`~array_api.tensordot`.
410410
"""
411411

412412
def trace(x: array, /, *, offset: int = 0) -> array:
@@ -440,7 +440,7 @@ def trace(x: array, /, *, offset: int = 0) -> array:
440440

441441
def vecdot(x1: array, x2: array, /, *, axis: int = None) -> array:
442442
"""
443-
Alias for :func:`~array_api.linear_algebra_functions.vecdot`.
443+
Alias for :func:`~array_api.vecdot`.
444444
"""
445445

446446
def vector_norm(x: array, /, *, axis: Optional[Union[int, Tuple[int, ...]]] = None, keepdims: bool = False, ord: Union[int, float, Literal[inf, -inf]] = 2) -> array:

spec/API_specification/array_object.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ Bitwise Operators
246246

247247
-------------------------------------------------
248248

249-
.. currentmodule:: array_api.array_object
249+
.. currentmodule:: array_api
250250

251251
Attributes
252252
----------

spec/API_specification/constants.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ A conforming implementation of the array API standard must provide and support t
1010
Objects in API
1111
--------------
1212

13-
.. currentmodule:: array_api.constants
13+
.. currentmodule:: array_api
1414

1515
..
1616
NOTE: please keep the functions in alphabetical order

spec/API_specification/creation_functions.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ A conforming implementation of the array API standard must provide and support t
1111
Objects in API
1212
--------------
1313

14-
.. currentmodule:: array_api.creation_functions
14+
.. currentmodule:: array_api
1515

1616
..
1717
NOTE: please keep the functions in alphabetical order

spec/API_specification/data_type_functions.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ A conforming implementation of the array API standard must provide and support t
99
Objects in API
1010
--------------
1111

12-
.. currentmodule:: array_api.data_type_functions
12+
.. currentmodule:: array_api
1313

1414
..
1515
NOTE: please keep the functions in alphabetical order

spec/API_specification/elementwise_functions.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ A conforming implementation of the array API standard must provide and support t
1919
Objects in API
2020
--------------
2121

22-
.. currentmodule:: array_api.elementwise_functions
22+
.. currentmodule:: array_api
2323

2424
..
2525
NOTE: please keep the functions in alphabetical order

spec/API_specification/indexing.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ Multi-dimensional arrays must extend the concept of single-axis indexing to mult
154154
- Each ``None`` in the selection tuple must expand the dimensions of the resulting selection by one dimension of size ``1``. The position of the added dimension must be the same as the position of ``None`` in the selection tuple.
155155

156156
.. note::
157-
Expanding dimensions can be equivalently achieved via repeated invocation of :func:`~array_api.manipulation_functions.expand_dims`.
157+
Expanding dimensions can be equivalently achieved via repeated invocation of :func:`~array_api.expand_dims`.
158158

159159
- Except in the case of providing a single ellipsis (e.g., ``A[2:10, ...]`` or ``A[1:, ..., 2:5]``), the number of provided single-axis indexing expressions (excluding ``None``) should equal ``N``. For example, if ``A`` has rank ``2``, a single-axis indexing expression should be explicitly provided for both axes (e.g., ``A[2:10, :]``). An ``IndexError`` exception should be raised if the number of provided single-axis indexing expressions (excluding ``None``) is less than ``N``.
160160

@@ -181,7 +181,7 @@ Boolean Array Indexing
181181
An array must support indexing where the **sole index** is an ``M``-dimensional boolean array ``B`` with shape ``S1 = (s1, ..., sM)`` according to the following rules. Let ``A`` be an ``N``-dimensional array with shape ``S2 = (s1, ..., sM, ..., sN)``.
182182

183183
.. note::
184-
The prohibition against combining boolean array indices with other single-axis indexing expressions includes the use of ``None``. To expand dimensions of the returned array, use repeated invocation of :func:`~array_api.manipulation_functions.expand_dims`.
184+
The prohibition against combining boolean array indices with other single-axis indexing expressions includes the use of ``None``. To expand dimensions of the returned array, use repeated invocation of :func:`~array_api.expand_dims`.
185185

186186
- If ``N >= M``, then ``A[B]`` must replace the first ``M`` dimensions of ``A`` with a single dimension having a size equal to the number of ``True`` elements in ``B``. The values in the resulting array must be in row-major (C-style order); this is equivalent to ``A[nonzero(B)]``.
187187

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy