From a137bd8119db93521516a51d98101a51dc4c96ab Mon Sep 17 00:00:00 2001 From: Stephannie Jimenez Date: Wed, 11 May 2022 18:01:49 +0200 Subject: [PATCH 1/7] Rename signatures module to array_api --- spec/API_specification/array_api/__init__.py | 15 ++++++ .../{signatures => array_api}/_types.py | 0 .../{signatures => array_api}/array_object.py | 52 ++++++++++--------- .../{signatures => array_api}/constants.py | 0 .../creation_functions.py | 2 +- .../data_type_functions.py | 0 .../{signatures => array_api}/data_types.py | 0 .../elementwise_functions.py | 0 .../{signatures => array_api}/linalg.py | 8 +-- .../linear_algebra_functions.py | 0 .../manipulation_functions.py | 0 .../searching_functions.py | 0 .../set_functions.py | 0 .../sorting_functions.py | 0 .../statistical_functions.py | 0 .../utility_functions.py | 0 spec/API_specification/array_object.rst | 2 +- spec/API_specification/constants.rst | 2 +- spec/API_specification/creation_functions.rst | 2 +- .../API_specification/data_type_functions.rst | 2 +- spec/API_specification/data_types.rst | 2 +- .../elementwise_functions.rst | 2 +- spec/API_specification/indexing.rst | 4 +- .../linear_algebra_functions.rst | 2 +- .../manipulation_functions.rst | 2 +- .../API_specification/searching_functions.rst | 2 +- spec/API_specification/set_functions.rst | 2 +- spec/API_specification/signatures/__init__.py | 0 spec/API_specification/sorting_functions.rst | 2 +- .../statistical_functions.rst | 2 +- spec/API_specification/utility_functions.rst | 2 +- spec/conf.py | 4 +- spec/extensions/linear_algebra_functions.rst | 2 +- 33 files changed, 65 insertions(+), 48 deletions(-) create mode 100644 spec/API_specification/array_api/__init__.py rename spec/API_specification/{signatures => array_api}/_types.py (100%) rename spec/API_specification/{signatures => array_api}/array_object.py (95%) rename spec/API_specification/{signatures => array_api}/constants.py (100%) rename spec/API_specification/{signatures => array_api}/creation_functions.py (99%) rename spec/API_specification/{signatures => array_api}/data_type_functions.py (100%) rename spec/API_specification/{signatures => array_api}/data_types.py (100%) rename spec/API_specification/{signatures => array_api}/elementwise_functions.py (100%) rename spec/API_specification/{signatures => array_api}/linalg.py (99%) rename spec/API_specification/{signatures => array_api}/linear_algebra_functions.py (100%) rename spec/API_specification/{signatures => array_api}/manipulation_functions.py (100%) rename spec/API_specification/{signatures => array_api}/searching_functions.py (100%) rename spec/API_specification/{signatures => array_api}/set_functions.py (100%) rename spec/API_specification/{signatures => array_api}/sorting_functions.py (100%) rename spec/API_specification/{signatures => array_api}/statistical_functions.py (100%) rename spec/API_specification/{signatures => array_api}/utility_functions.py (100%) delete mode 100644 spec/API_specification/signatures/__init__.py diff --git a/spec/API_specification/array_api/__init__.py b/spec/API_specification/array_api/__init__.py new file mode 100644 index 000000000..a3521d768 --- /dev/null +++ b/spec/API_specification/array_api/__init__.py @@ -0,0 +1,15 @@ +from .array_object import * +from .constants import * +from .creation_functions import * +from .data_type_functions import * +from .data_types import * +from .elementwise_functions import * +from .linear_algebra_functions import * +from .manipulation_functions import * +from .searching_functions import * +from .set_functions import * +from .sorting_functions import * +from .statistical_functions import * +from .utility_functions import * + +#__all__ = ['Any', 'Device', 'Dtype', 'Enum', 'Optional', 'PyCapsule', 'Tuple', 'Union', '_types', 'abs', 'acos', 'acosh', 'add', 'all', 'annotations', 'any', 'arange', 'argmax', 'argmin', 'argsort', 'array', 'array_object', 'asarray', 'asin', 'asinh', 'astype', 'atan', 'atan2', 'atanh', 'bitwise_and', 'bitwise_invert', 'bitwise_left_shift', 'bitwise_or', 'bitwise_right_shift', 'bitwise_xor', 'broadcast_arrays', 'broadcast_to', 'can_cast', 'ceil', 'concat', 'constants', 'cos', 'cosh', 'creation_functions', 'data_type_functions', 'data_types', 'divide', 'dtype', 'e', 'elementwise_functions', 'ellipsis', 'empty', 'empty_like', 'equal', 'exp', 'expand_dims', 'expm1', 'eye', 'finfo', 'flip', 'floor', 'floor_divide', 'from_dlpack', 'full', 'full_like', 'greater', 'greater_equal', 'iinfo', 'inf', 'isfinite', 'isinf', 'isnan', 'less', 'less_equal', 'linear_algebra_functions', 'linspace', 'log', 'log10', 'log1p', 'log2', 'logaddexp', 'logical_and', 'logical_not', 'logical_or', 'logical_xor', 'manipulation_functions', 'matmul', 'matrix_transpose', 'max', 'mean', 'meshgrid', 'min', 'multiply', 'nan', 'negative', 'newaxis', 'nonzero', 'not_equal', 'ones', 'ones_like', 'permute_dims', 'pi', 'positive', 'pow', 'prod', 'remainder', 'reshape', 'result_type', 'roll', 'round', 'searching_functions', 'set_functions', 'sign', 'sin', 'sinh', 'sort', 'sorting_functions', 'sqrt', 'square', 'squeeze', 'stack', 'statistical_functions', 'std', 'subtract', 'sum', 'tan', 'tanh', 'tensordot', 'tril', 'triu', 'trunc', 'unique_all', 'unique_counts', 'unique_inverse', 'unique_values', 'utility_functions', 'var', 'vecdot', 'where', 'zeros', 'zeros_like'] \ No newline at end of file diff --git a/spec/API_specification/signatures/_types.py b/spec/API_specification/array_api/_types.py similarity index 100% rename from spec/API_specification/signatures/_types.py rename to spec/API_specification/array_api/_types.py diff --git a/spec/API_specification/signatures/array_object.py b/spec/API_specification/array_api/array_object.py similarity index 95% rename from spec/API_specification/signatures/array_object.py rename to spec/API_specification/array_api/array_object.py index 970f641a1..5f72a1b18 100644 --- a/spec/API_specification/signatures/array_object.py +++ b/spec/API_specification/array_api/array_object.py @@ -135,7 +135,7 @@ def __abs__(self: array, /) -> array: .. note:: - Element-wise results must equal the results returned by the equivalent element-wise function :func:`~signatures.elementwise_functions.abs`. + Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.abs`. """ def __add__(self: array, other: Union[int, float, array], /) -> array: @@ -181,7 +181,7 @@ def __add__(self: array, other: Union[int, float, array], /) -> array: .. note:: - Element-wise results must equal the results returned by the equivalent element-wise function :func:`~signatures.elementwise_functions.add`. + Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.add`. """ def __and__(self: array, other: Union[int, bool, array], /) -> array: @@ -202,7 +202,7 @@ def __and__(self: array, other: Union[int, bool, array], /) -> array: .. note:: - Element-wise results must equal the results returned by the equivalent element-wise function :func:`~signatures.elementwise_functions.bitwise_and`. + Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.bitwise_and`. """ def __array_namespace__(self: array, /, *, api_version: Optional[str] = None) -> Any: @@ -239,7 +239,7 @@ def __bool__(self: array, /) -> bool: def __dlpack__(self: array, /, *, stream: Optional[Union[int, Any]] = None) -> PyCapsule: """ - Exports the array for consumption by :func:`~signatures.creation_functions.from_dlpack` as a DLPack capsule. + Exports the array for consumption by :func:`~array_api.creation_functions.from_dlpack` as a DLPack capsule. Parameters ---------- @@ -294,7 +294,7 @@ def __dlpack__(self: array, /, *, stream: Optional[Union[int, Any]] = None) -> P def __dlpack_device__(self: array, /) -> Tuple[Enum, int]: """ - Returns device type and device ID in DLPack format. Meant for use within :func:`~signatures.creation_functions.from_dlpack`. + Returns device type and device ID in DLPack format. Meant for use within :func:`~array_api.creation_functions.from_dlpack`. Parameters ---------- @@ -336,7 +336,7 @@ def __eq__(self: array, other: Union[int, float, bool, array], /) -> array: .. note:: - Element-wise results must equal the results returned by the equivalent element-wise function :func:`~signatures.elementwise_functions.equal`. + Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.equal`. """ def __float__(self: array, /) -> float: @@ -411,7 +411,7 @@ def __floordiv__(self: array, other: Union[int, float, array], /) -> array: .. note:: - Element-wise results must equal the results returned by the equivalent element-wise function :func:`~signatures.elementwise_functions.floor_divide`. + Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.floor_divide`. """ def __ge__(self: array, other: Union[int, float, array], /) -> array: @@ -432,7 +432,7 @@ def __ge__(self: array, other: Union[int, float, array], /) -> array: .. note:: - Element-wise results must equal the results returned by the equivalent element-wise function :func:`~signatures.elementwise_functions.greater_equal`. + Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.greater_equal`. """ 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: .. note:: - Element-wise results must equal the results returned by the equivalent element-wise function :func:`~signatures.elementwise_functions.greater`. + Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.greater`. """ def __index__(self: array, /) -> int: @@ -522,7 +522,7 @@ def __invert__(self: array, /) -> array: .. note:: - Element-wise results must equal the results returned by the equivalent element-wise function :func:`~signatures.elementwise_functions.bitwise_invert`. + Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.bitwise_invert`. """ def __le__(self: array, other: Union[int, float, array], /) -> array: @@ -543,7 +543,7 @@ def __le__(self: array, other: Union[int, float, array], /) -> array: .. note:: - Element-wise results must equal the results returned by the equivalent element-wise function :func:`~signatures.elementwise_functions.less_equal`. + Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.less_equal`. """ def __lshift__(self: array, other: Union[int, array], /) -> array: @@ -564,7 +564,7 @@ def __lshift__(self: array, other: Union[int, array], /) -> array: .. note:: - Element-wise results must equal the results returned by the equivalent element-wise function :func:`~signatures.elementwise_functions.bitwise_left_shift`. + Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.bitwise_left_shift`. """ def __lt__(self: array, other: Union[int, float, array], /) -> array: @@ -585,7 +585,7 @@ def __lt__(self: array, other: Union[int, float, array], /) -> array: .. note:: - Element-wise results must equal the results returned by the equivalent element-wise function :func:`~signatures.elementwise_functions.less`. + Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.less`. """ def __matmul__(self: array, other: array, /) -> array: @@ -616,7 +616,7 @@ def __matmul__(self: array, other: array, /) -> array: .. note:: - Results must equal the results returned by the equivalent function :func:`~signatures.linear_algebra_functions.matmul`. + Results must equal the results returned by the equivalent function :func:`~array_api.linear_algebra_functions.matmul`. **Raises** @@ -676,7 +676,7 @@ def __mod__(self: array, other: Union[int, float, array], /) -> array: .. note:: - Element-wise results must equal the results returned by the equivalent element-wise function :func:`~signatures.elementwise_functions.remainder`. + Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.remainder`. """ def __mul__(self: array, other: Union[int, float, array], /) -> array: @@ -715,7 +715,7 @@ def __mul__(self: array, other: Union[int, float, array], /) -> array: .. note:: - Element-wise results must equal the results returned by the equivalent element-wise function :func:`~signatures.elementwise_functions.multiply`. + Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.multiply`. """ 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: .. note:: - Element-wise results must equal the results returned by the equivalent element-wise function :func:`~signatures.elementwise_functions.not_equal`. + Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.not_equal`. """ def __neg__(self: array, /) -> array: @@ -758,7 +758,7 @@ def __neg__(self: array, /) -> array: .. note:: - Element-wise results must equal the results returned by the equivalent element-wise function :func:`~signatures.elementwise_functions.negative`. + Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.negative`. """ def __or__(self: array, other: Union[int, bool, array], /) -> array: @@ -779,7 +779,7 @@ def __or__(self: array, other: Union[int, bool, array], /) -> array: .. note:: - Element-wise results must equal the results returned by the equivalent element-wise function :func:`~signatures.elementwise_functions.bitwise_or`. + Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.bitwise_or`. """ def __pos__(self: array, /) -> array: @@ -798,7 +798,7 @@ def __pos__(self: array, /) -> array: .. note:: - Element-wise results must equal the results returned by the equivalent element-wise function :func:`~signatures.elementwise_functions.positive`. + Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.positive`. """ def __pow__(self: array, other: Union[int, float, array], /) -> array: @@ -853,7 +853,7 @@ def __pow__(self: array, other: Union[int, float, array], /) -> array: .. note:: - Element-wise results must equal the results returned by the equivalent element-wise function :func:`~signatures.elementwise_functions.pow`. + Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.pow`. """ def __rshift__(self: array, other: Union[int, array], /) -> array: @@ -874,7 +874,7 @@ def __rshift__(self: array, other: Union[int, array], /) -> array: .. note:: - Element-wise results must equal the results returned by the equivalent element-wise function :func:`~signatures.elementwise_functions.bitwise_right_shift`. + Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.bitwise_right_shift`. """ 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: .. note:: - Element-wise results must equal the results returned by the equivalent element-wise function :func:`~signatures.elementwise_functions.subtract`. + Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.subtract`. """ def __truediv__(self: array, other: Union[int, float, array], /) -> array: @@ -971,7 +971,7 @@ def __truediv__(self: array, other: Union[int, float, array], /) -> array: .. note:: - Element-wise results must equal the results returned by the equivalent element-wise function :func:`~signatures.elementwise_functions.divide`. + Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.divide`. """ def __xor__(self: array, other: Union[int, bool, array], /) -> array: @@ -992,7 +992,7 @@ def __xor__(self: array, other: Union[int, bool, array], /) -> array: .. note:: - Element-wise results must equal the results returned by the equivalent element-wise function :func:`~signatures.elementwise_functions.bitwise_xor`. + Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.bitwise_xor`. """ def to_device(self: array, device: Device, /, *, stream: Optional[Union[int, Any]] = None) -> array: @@ -1019,3 +1019,5 @@ def to_device(self: array, device: Device, /, *, stream: Optional[Union[int, Any """ array = _array + +__all__ = ['array'] \ No newline at end of file diff --git a/spec/API_specification/signatures/constants.py b/spec/API_specification/array_api/constants.py similarity index 100% rename from spec/API_specification/signatures/constants.py rename to spec/API_specification/array_api/constants.py diff --git a/spec/API_specification/signatures/creation_functions.py b/spec/API_specification/array_api/creation_functions.py similarity index 99% rename from spec/API_specification/signatures/creation_functions.py rename to spec/API_specification/array_api/creation_functions.py index 88db02340..bcfb6052f 100644 --- a/spec/API_specification/signatures/creation_functions.py +++ b/spec/API_specification/array_api/creation_functions.py @@ -54,7 +54,7 @@ def asarray(obj: Union[array, bool, int, float, NestedSequence, SupportsBufferPr .. admonition:: Note :class: note - 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:`signatures.data_type_functions.astype`. + 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`. .. note:: If an input value exceeds the precision of the resolved output array data type, behavior is left unspecified and, thus, implementation-defined. diff --git a/spec/API_specification/signatures/data_type_functions.py b/spec/API_specification/array_api/data_type_functions.py similarity index 100% rename from spec/API_specification/signatures/data_type_functions.py rename to spec/API_specification/array_api/data_type_functions.py diff --git a/spec/API_specification/signatures/data_types.py b/spec/API_specification/array_api/data_types.py similarity index 100% rename from spec/API_specification/signatures/data_types.py rename to spec/API_specification/array_api/data_types.py diff --git a/spec/API_specification/signatures/elementwise_functions.py b/spec/API_specification/array_api/elementwise_functions.py similarity index 100% rename from spec/API_specification/signatures/elementwise_functions.py rename to spec/API_specification/array_api/elementwise_functions.py diff --git a/spec/API_specification/signatures/linalg.py b/spec/API_specification/array_api/linalg.py similarity index 99% rename from spec/API_specification/signatures/linalg.py rename to spec/API_specification/array_api/linalg.py index 275fa3158..0c5e73851 100644 --- a/spec/API_specification/signatures/linalg.py +++ b/spec/API_specification/array_api/linalg.py @@ -157,7 +157,7 @@ def inv(x: array, /) -> array: def matmul(x1: array, x2: array, /) -> array: """ - Alias for :func:`~signatures.linear_algebra_functions.matmul`. + Alias for :func:`~array_api.linear_algebra_functions.matmul`. """ 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 def matrix_transpose(x: array, /) -> array: """ - Alias for :func:`~signatures.linear_algebra_functions.matrix_transpose`. + Alias for :func:`~array_api.linear_algebra_functions.matrix_transpose`. """ def outer(x1: array, x2: array, /) -> array: @@ -406,7 +406,7 @@ def svdvals(x: array, /) -> array: def tensordot(x1: array, x2: array, /, *, axes: Union[int, Tuple[Sequence[int], Sequence[int]]] = 2) -> array: """ - Alias for :func:`~signatures.linear_algebra_functions.tensordot`. + Alias for :func:`~array_api.linear_algebra_functions.tensordot`. """ def trace(x: array, /, *, offset: int = 0) -> array: @@ -440,7 +440,7 @@ def trace(x: array, /, *, offset: int = 0) -> array: def vecdot(x1: array, x2: array, /, *, axis: int = None) -> array: """ - Alias for :func:`~signatures.linear_algebra_functions.vecdot`. + Alias for :func:`~array_api.linear_algebra_functions.vecdot`. """ def vector_norm(x: array, /, *, axis: Optional[Union[int, Tuple[int, ...]]] = None, keepdims: bool = False, ord: Union[int, float, Literal[inf, -inf]] = 2) -> array: diff --git a/spec/API_specification/signatures/linear_algebra_functions.py b/spec/API_specification/array_api/linear_algebra_functions.py similarity index 100% rename from spec/API_specification/signatures/linear_algebra_functions.py rename to spec/API_specification/array_api/linear_algebra_functions.py diff --git a/spec/API_specification/signatures/manipulation_functions.py b/spec/API_specification/array_api/manipulation_functions.py similarity index 100% rename from spec/API_specification/signatures/manipulation_functions.py rename to spec/API_specification/array_api/manipulation_functions.py diff --git a/spec/API_specification/signatures/searching_functions.py b/spec/API_specification/array_api/searching_functions.py similarity index 100% rename from spec/API_specification/signatures/searching_functions.py rename to spec/API_specification/array_api/searching_functions.py diff --git a/spec/API_specification/signatures/set_functions.py b/spec/API_specification/array_api/set_functions.py similarity index 100% rename from spec/API_specification/signatures/set_functions.py rename to spec/API_specification/array_api/set_functions.py diff --git a/spec/API_specification/signatures/sorting_functions.py b/spec/API_specification/array_api/sorting_functions.py similarity index 100% rename from spec/API_specification/signatures/sorting_functions.py rename to spec/API_specification/array_api/sorting_functions.py diff --git a/spec/API_specification/signatures/statistical_functions.py b/spec/API_specification/array_api/statistical_functions.py similarity index 100% rename from spec/API_specification/signatures/statistical_functions.py rename to spec/API_specification/array_api/statistical_functions.py diff --git a/spec/API_specification/signatures/utility_functions.py b/spec/API_specification/array_api/utility_functions.py similarity index 100% rename from spec/API_specification/signatures/utility_functions.py rename to spec/API_specification/array_api/utility_functions.py diff --git a/spec/API_specification/array_object.rst b/spec/API_specification/array_object.rst index 55a8ff0ab..b397254a0 100644 --- a/spec/API_specification/array_object.rst +++ b/spec/API_specification/array_object.rst @@ -246,7 +246,7 @@ Bitwise Operators ------------------------------------------------- -.. currentmodule:: signatures.array_object +.. currentmodule:: array_api.array_object Attributes ---------- diff --git a/spec/API_specification/constants.rst b/spec/API_specification/constants.rst index 4d71ed380..71cb8688d 100644 --- a/spec/API_specification/constants.rst +++ b/spec/API_specification/constants.rst @@ -10,7 +10,7 @@ A conforming implementation of the array API standard must provide and support t Objects in API -------------- -.. currentmodule:: signatures.constants +.. currentmodule:: array_api.constants .. NOTE: please keep the functions in alphabetical order diff --git a/spec/API_specification/creation_functions.rst b/spec/API_specification/creation_functions.rst index c34f67378..fdbdf9084 100644 --- a/spec/API_specification/creation_functions.rst +++ b/spec/API_specification/creation_functions.rst @@ -11,7 +11,7 @@ A conforming implementation of the array API standard must provide and support t Objects in API -------------- -.. currentmodule:: signatures.creation_functions +.. currentmodule:: array_api.creation_functions .. NOTE: please keep the functions in alphabetical order diff --git a/spec/API_specification/data_type_functions.rst b/spec/API_specification/data_type_functions.rst index 4b35a297a..7d06f919b 100644 --- a/spec/API_specification/data_type_functions.rst +++ b/spec/API_specification/data_type_functions.rst @@ -9,7 +9,7 @@ A conforming implementation of the array API standard must provide and support t Objects in API -------------- -.. currentmodule:: signatures.data_type_functions +.. currentmodule:: array_api.data_type_functions .. NOTE: please keep the functions in alphabetical order diff --git a/spec/API_specification/data_types.rst b/spec/API_specification/data_types.rst index f40006c4e..652326beb 100644 --- a/spec/API_specification/data_types.rst +++ b/spec/API_specification/data_types.rst @@ -100,7 +100,7 @@ Methods .. NOTE: please keep the functions in alphabetical order -.. currentmodule:: signatures.data_types +.. currentmodule:: array_api.data_types .. autosummary:: :toctree: generated diff --git a/spec/API_specification/elementwise_functions.rst b/spec/API_specification/elementwise_functions.rst index 316ac8ce9..25f807ee7 100644 --- a/spec/API_specification/elementwise_functions.rst +++ b/spec/API_specification/elementwise_functions.rst @@ -19,7 +19,7 @@ A conforming implementation of the array API standard must provide and support t Objects in API -------------- -.. currentmodule:: signatures.elementwise_functions +.. currentmodule:: array_api.elementwise_functions .. NOTE: please keep the functions in alphabetical order diff --git a/spec/API_specification/indexing.rst b/spec/API_specification/indexing.rst index 13fe70a3f..73002990a 100644 --- a/spec/API_specification/indexing.rst +++ b/spec/API_specification/indexing.rst @@ -154,7 +154,7 @@ Multi-dimensional arrays must extend the concept of single-axis indexing to mult - 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. .. note:: - Expanding dimensions can be equivalently achieved via repeated invocation of :func:`~signatures.manipulation_functions.expand_dims`. + Expanding dimensions can be equivalently achieved via repeated invocation of :func:`~array_api.manipulation_functions.expand_dims`. - 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``. @@ -181,7 +181,7 @@ Boolean Array Indexing 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)``. .. note:: - 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:`~signatures.manipulation_functions.expand_dims`. + 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`. - 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)]``. diff --git a/spec/API_specification/linear_algebra_functions.rst b/spec/API_specification/linear_algebra_functions.rst index c12144aa4..5900459d9 100644 --- a/spec/API_specification/linear_algebra_functions.rst +++ b/spec/API_specification/linear_algebra_functions.rst @@ -12,7 +12,7 @@ A conforming implementation of the array API standard must provide and support t * Unless stated otherwise, functions must adhere to the type promotion rules defined in :ref:`type-promotion`. * Unless stated otherwise, floating-point operations must adhere to IEEE 754-2019. -.. currentmodule:: signatures.linear_algebra_functions +.. currentmodule:: array_api.linear_algebra_functions Objects in API -------------- diff --git a/spec/API_specification/manipulation_functions.rst b/spec/API_specification/manipulation_functions.rst index f2fcbccc5..b3891f676 100644 --- a/spec/API_specification/manipulation_functions.rst +++ b/spec/API_specification/manipulation_functions.rst @@ -12,7 +12,7 @@ A conforming implementation of the array API standard must provide and support t Objects in API -------------- -.. currentmodule:: signatures.manipulation_functions +.. currentmodule:: array_api.manipulation_functions .. NOTE: please keep the functions in alphabetical order diff --git a/spec/API_specification/searching_functions.rst b/spec/API_specification/searching_functions.rst index b8a2b39a5..874e2f938 100644 --- a/spec/API_specification/searching_functions.rst +++ b/spec/API_specification/searching_functions.rst @@ -16,7 +16,7 @@ A conforming implementation of the array API standard must provide and support t Objects in API -------------- -.. currentmodule:: signatures.searching_functions +.. currentmodule:: array_api.searching_functions .. NOTE: please keep the functions in alphabetical order diff --git a/spec/API_specification/set_functions.rst b/spec/API_specification/set_functions.rst index 4ba2ad424..be82ecc82 100644 --- a/spec/API_specification/set_functions.rst +++ b/spec/API_specification/set_functions.rst @@ -12,7 +12,7 @@ A conforming implementation of the array API standard must provide and support t Objects in API -------------- -.. currentmodule:: signatures.set_functions +.. currentmodule:: array_api.set_functions .. NOTE: please keep the functions in alphabetical order diff --git a/spec/API_specification/signatures/__init__.py b/spec/API_specification/signatures/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/spec/API_specification/sorting_functions.rst b/spec/API_specification/sorting_functions.rst index da0ff99d1..40c86e9b4 100644 --- a/spec/API_specification/sorting_functions.rst +++ b/spec/API_specification/sorting_functions.rst @@ -19,7 +19,7 @@ A conforming implementation of the array API standard must provide and support t While defining a sort order for IEEE 754 floating-point numbers is recommended in order to facilitate reproducible and consistent sort results, doing so is not currently required by this specification. -.. currentmodule:: signatures.sorting_functions +.. currentmodule:: array_api.sorting_functions Objects in API -------------- diff --git a/spec/API_specification/statistical_functions.rst b/spec/API_specification/statistical_functions.rst index d87f5d25a..a43154075 100644 --- a/spec/API_specification/statistical_functions.rst +++ b/spec/API_specification/statistical_functions.rst @@ -15,7 +15,7 @@ A conforming implementation of the array API standard must provide and support t Objects in API -------------- -.. currentmodule:: signatures.statistical_functions +.. currentmodule:: array_api.statistical_functions .. NOTE: please keep the functions in alphabetical order diff --git a/spec/API_specification/utility_functions.rst b/spec/API_specification/utility_functions.rst index 887819194..4ee4c33f8 100644 --- a/spec/API_specification/utility_functions.rst +++ b/spec/API_specification/utility_functions.rst @@ -15,7 +15,7 @@ A conforming implementation of the array API standard must provide and support t Objects in API -------------- -.. currentmodule:: signatures.utility_functions +.. currentmodule:: array_api.utility_functions .. NOTE: please keep the functions in alphabetical order diff --git a/spec/conf.py b/spec/conf.py index bbb2f5d1d..dfaa3df57 100644 --- a/spec/conf.py +++ b/spec/conf.py @@ -197,9 +197,9 @@ def process_signature(app, what, name, obj, options, signature, return_annotation): if signature: - signature = signature.replace("signatures._types.", "") + signature = signature.replace("array_api._types.", "") if return_annotation: - return_annotation = return_annotation.replace("signatures._types.", "") + return_annotation = return_annotation.replace("array_api._types.", "") return signature, return_annotation def setup(app): diff --git a/spec/extensions/linear_algebra_functions.rst b/spec/extensions/linear_algebra_functions.rst index b82a913de..dbe643bed 100644 --- a/spec/extensions/linear_algebra_functions.rst +++ b/spec/extensions/linear_algebra_functions.rst @@ -74,7 +74,7 @@ Accordingly, the standardization process affords the opportunity to reduce inter where ``dot`` is overloaded based on input array dimensionality and ``vdot`` and ``inner`` exhibit a high degree of overlap with other interfaces. By consolidating interfaces and more clearly delineating behavior, this specification aims to ensure that each interface has a unique purpose and defined use case. -.. currentmodule:: signatures.linalg +.. currentmodule:: array_api.linalg Objects in API -------------- From 4ac3ce9d044a48dc52b12f82960a32a368b2bfcf Mon Sep 17 00:00:00 2001 From: Stephannie Jimenez Date: Wed, 11 May 2022 18:46:32 +0200 Subject: [PATCH 2/7] Remove unused code --- spec/API_specification/array_api/__init__.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/spec/API_specification/array_api/__init__.py b/spec/API_specification/array_api/__init__.py index a3521d768..ecfc5b88a 100644 --- a/spec/API_specification/array_api/__init__.py +++ b/spec/API_specification/array_api/__init__.py @@ -11,5 +11,3 @@ from .sorting_functions import * from .statistical_functions import * from .utility_functions import * - -#__all__ = ['Any', 'Device', 'Dtype', 'Enum', 'Optional', 'PyCapsule', 'Tuple', 'Union', '_types', 'abs', 'acos', 'acosh', 'add', 'all', 'annotations', 'any', 'arange', 'argmax', 'argmin', 'argsort', 'array', 'array_object', 'asarray', 'asin', 'asinh', 'astype', 'atan', 'atan2', 'atanh', 'bitwise_and', 'bitwise_invert', 'bitwise_left_shift', 'bitwise_or', 'bitwise_right_shift', 'bitwise_xor', 'broadcast_arrays', 'broadcast_to', 'can_cast', 'ceil', 'concat', 'constants', 'cos', 'cosh', 'creation_functions', 'data_type_functions', 'data_types', 'divide', 'dtype', 'e', 'elementwise_functions', 'ellipsis', 'empty', 'empty_like', 'equal', 'exp', 'expand_dims', 'expm1', 'eye', 'finfo', 'flip', 'floor', 'floor_divide', 'from_dlpack', 'full', 'full_like', 'greater', 'greater_equal', 'iinfo', 'inf', 'isfinite', 'isinf', 'isnan', 'less', 'less_equal', 'linear_algebra_functions', 'linspace', 'log', 'log10', 'log1p', 'log2', 'logaddexp', 'logical_and', 'logical_not', 'logical_or', 'logical_xor', 'manipulation_functions', 'matmul', 'matrix_transpose', 'max', 'mean', 'meshgrid', 'min', 'multiply', 'nan', 'negative', 'newaxis', 'nonzero', 'not_equal', 'ones', 'ones_like', 'permute_dims', 'pi', 'positive', 'pow', 'prod', 'remainder', 'reshape', 'result_type', 'roll', 'round', 'searching_functions', 'set_functions', 'sign', 'sin', 'sinh', 'sort', 'sorting_functions', 'sqrt', 'square', 'squeeze', 'stack', 'statistical_functions', 'std', 'subtract', 'sum', 'tan', 'tanh', 'tensordot', 'tril', 'triu', 'trunc', 'unique_all', 'unique_counts', 'unique_inverse', 'unique_values', 'utility_functions', 'var', 'vecdot', 'where', 'zeros', 'zeros_like'] \ No newline at end of file From 9a25cdfab952e25ce2a5374b32e6fae71c602229 Mon Sep 17 00:00:00 2001 From: Leo Fang Date: Wed, 11 May 2022 21:17:58 -0700 Subject: [PATCH 3/7] flatten the namespace in both .rst and .py --- spec/API_specification/array_api/__init__.py | 1 + .../array_api/array_object.py | 52 +++++++++---------- .../array_api/creation_functions.py | 2 +- spec/API_specification/array_api/linalg.py | 8 +-- spec/API_specification/array_object.rst | 2 +- spec/API_specification/constants.rst | 2 +- spec/API_specification/creation_functions.rst | 2 +- .../API_specification/data_type_functions.rst | 2 +- .../elementwise_functions.rst | 2 +- spec/API_specification/indexing.rst | 4 +- .../linear_algebra_functions.rst | 2 +- .../manipulation_functions.rst | 2 +- .../API_specification/searching_functions.rst | 2 +- spec/API_specification/set_functions.rst | 2 +- spec/API_specification/sorting_functions.rst | 2 +- .../statistical_functions.rst | 2 +- spec/API_specification/utility_functions.rst | 2 +- spec/Makefile | 1 + 18 files changed, 47 insertions(+), 45 deletions(-) diff --git a/spec/API_specification/array_api/__init__.py b/spec/API_specification/array_api/__init__.py index ecfc5b88a..31d92e99c 100644 --- a/spec/API_specification/array_api/__init__.py +++ b/spec/API_specification/array_api/__init__.py @@ -11,3 +11,4 @@ from .sorting_functions import * from .statistical_functions import * from .utility_functions import * +from . import linalg diff --git a/spec/API_specification/array_api/array_object.py b/spec/API_specification/array_api/array_object.py index 5f72a1b18..472bb74bc 100644 --- a/spec/API_specification/array_api/array_object.py +++ b/spec/API_specification/array_api/array_object.py @@ -135,7 +135,7 @@ def __abs__(self: array, /) -> array: .. note:: - Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.abs`. + Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.abs`. """ def __add__(self: array, other: Union[int, float, array], /) -> array: @@ -181,7 +181,7 @@ def __add__(self: array, other: Union[int, float, array], /) -> array: .. note:: - Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.add`. + Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.add`. """ def __and__(self: array, other: Union[int, bool, array], /) -> array: @@ -202,7 +202,7 @@ def __and__(self: array, other: Union[int, bool, array], /) -> array: .. note:: - Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.bitwise_and`. + Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.bitwise_and`. """ def __array_namespace__(self: array, /, *, api_version: Optional[str] = None) -> Any: @@ -239,7 +239,7 @@ def __bool__(self: array, /) -> bool: def __dlpack__(self: array, /, *, stream: Optional[Union[int, Any]] = None) -> PyCapsule: """ - Exports the array for consumption by :func:`~array_api.creation_functions.from_dlpack` as a DLPack capsule. + Exports the array for consumption by :func:`~array_api.from_dlpack` as a DLPack capsule. Parameters ---------- @@ -294,7 +294,7 @@ def __dlpack__(self: array, /, *, stream: Optional[Union[int, Any]] = None) -> P def __dlpack_device__(self: array, /) -> Tuple[Enum, int]: """ - Returns device type and device ID in DLPack format. Meant for use within :func:`~array_api.creation_functions.from_dlpack`. + Returns device type and device ID in DLPack format. Meant for use within :func:`~array_api.from_dlpack`. Parameters ---------- @@ -336,7 +336,7 @@ def __eq__(self: array, other: Union[int, float, bool, array], /) -> array: .. note:: - Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.equal`. + Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.equal`. """ def __float__(self: array, /) -> float: @@ -411,7 +411,7 @@ def __floordiv__(self: array, other: Union[int, float, array], /) -> array: .. note:: - Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.floor_divide`. + Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.floor_divide`. """ def __ge__(self: array, other: Union[int, float, array], /) -> array: @@ -432,7 +432,7 @@ def __ge__(self: array, other: Union[int, float, array], /) -> array: .. note:: - Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.greater_equal`. + Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.greater_equal`. """ 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: .. note:: - Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.greater`. + Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.greater`. """ def __index__(self: array, /) -> int: @@ -522,7 +522,7 @@ def __invert__(self: array, /) -> array: .. note:: - Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.bitwise_invert`. + Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.bitwise_invert`. """ def __le__(self: array, other: Union[int, float, array], /) -> array: @@ -543,7 +543,7 @@ def __le__(self: array, other: Union[int, float, array], /) -> array: .. note:: - Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.less_equal`. + Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.less_equal`. """ def __lshift__(self: array, other: Union[int, array], /) -> array: @@ -564,7 +564,7 @@ def __lshift__(self: array, other: Union[int, array], /) -> array: .. note:: - Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.bitwise_left_shift`. + Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.bitwise_left_shift`. """ def __lt__(self: array, other: Union[int, float, array], /) -> array: @@ -585,7 +585,7 @@ def __lt__(self: array, other: Union[int, float, array], /) -> array: .. note:: - Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.less`. + Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.less`. """ def __matmul__(self: array, other: array, /) -> array: @@ -616,7 +616,7 @@ def __matmul__(self: array, other: array, /) -> array: .. note:: - Results must equal the results returned by the equivalent function :func:`~array_api.linear_algebra_functions.matmul`. + Results must equal the results returned by the equivalent function :func:`~array_api.matmul`. **Raises** @@ -676,7 +676,7 @@ def __mod__(self: array, other: Union[int, float, array], /) -> array: .. note:: - Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.remainder`. + Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.remainder`. """ def __mul__(self: array, other: Union[int, float, array], /) -> array: @@ -715,7 +715,7 @@ def __mul__(self: array, other: Union[int, float, array], /) -> array: .. note:: - Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.multiply`. + Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.multiply`. """ 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: .. note:: - Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.not_equal`. + Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.not_equal`. """ def __neg__(self: array, /) -> array: @@ -758,7 +758,7 @@ def __neg__(self: array, /) -> array: .. note:: - Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.negative`. + Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.negative`. """ def __or__(self: array, other: Union[int, bool, array], /) -> array: @@ -779,7 +779,7 @@ def __or__(self: array, other: Union[int, bool, array], /) -> array: .. note:: - Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.bitwise_or`. + Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.bitwise_or`. """ def __pos__(self: array, /) -> array: @@ -798,7 +798,7 @@ def __pos__(self: array, /) -> array: .. note:: - Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.positive`. + Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.positive`. """ def __pow__(self: array, other: Union[int, float, array], /) -> array: @@ -853,7 +853,7 @@ def __pow__(self: array, other: Union[int, float, array], /) -> array: .. note:: - Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.pow`. + Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.pow`. """ def __rshift__(self: array, other: Union[int, array], /) -> array: @@ -874,7 +874,7 @@ def __rshift__(self: array, other: Union[int, array], /) -> array: .. note:: - Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.bitwise_right_shift`. + Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.bitwise_right_shift`. """ 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: .. note:: - Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.subtract`. + Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.subtract`. """ def __truediv__(self: array, other: Union[int, float, array], /) -> array: @@ -971,7 +971,7 @@ def __truediv__(self: array, other: Union[int, float, array], /) -> array: .. note:: - Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.divide`. + Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.divide`. """ def __xor__(self: array, other: Union[int, bool, array], /) -> array: @@ -992,7 +992,7 @@ def __xor__(self: array, other: Union[int, bool, array], /) -> array: .. note:: - Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.bitwise_xor`. + Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.bitwise_xor`. """ 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 array = _array -__all__ = ['array'] \ No newline at end of file +__all__ = ['array'] diff --git a/spec/API_specification/array_api/creation_functions.py b/spec/API_specification/array_api/creation_functions.py index bcfb6052f..3285a386d 100644 --- a/spec/API_specification/array_api/creation_functions.py +++ b/spec/API_specification/array_api/creation_functions.py @@ -54,7 +54,7 @@ def asarray(obj: Union[array, bool, int, float, NestedSequence, SupportsBufferPr .. admonition:: Note :class: note - 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`. + 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`. .. note:: If an input value exceeds the precision of the resolved output array data type, behavior is left unspecified and, thus, implementation-defined. diff --git a/spec/API_specification/array_api/linalg.py b/spec/API_specification/array_api/linalg.py index 0c5e73851..0749daf8e 100644 --- a/spec/API_specification/array_api/linalg.py +++ b/spec/API_specification/array_api/linalg.py @@ -157,7 +157,7 @@ def inv(x: array, /) -> array: def matmul(x1: array, x2: array, /) -> array: """ - Alias for :func:`~array_api.linear_algebra_functions.matmul`. + Alias for :func:`~array_api.matmul`. """ 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 def matrix_transpose(x: array, /) -> array: """ - Alias for :func:`~array_api.linear_algebra_functions.matrix_transpose`. + Alias for :func:`~array_api.matrix_transpose`. """ def outer(x1: array, x2: array, /) -> array: @@ -406,7 +406,7 @@ def svdvals(x: array, /) -> array: def tensordot(x1: array, x2: array, /, *, axes: Union[int, Tuple[Sequence[int], Sequence[int]]] = 2) -> array: """ - Alias for :func:`~array_api.linear_algebra_functions.tensordot`. + Alias for :func:`~array_api.tensordot`. """ def trace(x: array, /, *, offset: int = 0) -> array: @@ -440,7 +440,7 @@ def trace(x: array, /, *, offset: int = 0) -> array: def vecdot(x1: array, x2: array, /, *, axis: int = None) -> array: """ - Alias for :func:`~array_api.linear_algebra_functions.vecdot`. + Alias for :func:`~array_api.vecdot`. """ def vector_norm(x: array, /, *, axis: Optional[Union[int, Tuple[int, ...]]] = None, keepdims: bool = False, ord: Union[int, float, Literal[inf, -inf]] = 2) -> array: diff --git a/spec/API_specification/array_object.rst b/spec/API_specification/array_object.rst index b397254a0..32b775b6a 100644 --- a/spec/API_specification/array_object.rst +++ b/spec/API_specification/array_object.rst @@ -246,7 +246,7 @@ Bitwise Operators ------------------------------------------------- -.. currentmodule:: array_api.array_object +.. currentmodule:: array_api Attributes ---------- diff --git a/spec/API_specification/constants.rst b/spec/API_specification/constants.rst index 71cb8688d..abe256533 100644 --- a/spec/API_specification/constants.rst +++ b/spec/API_specification/constants.rst @@ -10,7 +10,7 @@ A conforming implementation of the array API standard must provide and support t Objects in API -------------- -.. currentmodule:: array_api.constants +.. currentmodule:: array_api .. NOTE: please keep the functions in alphabetical order diff --git a/spec/API_specification/creation_functions.rst b/spec/API_specification/creation_functions.rst index fdbdf9084..9984ff04c 100644 --- a/spec/API_specification/creation_functions.rst +++ b/spec/API_specification/creation_functions.rst @@ -11,7 +11,7 @@ A conforming implementation of the array API standard must provide and support t Objects in API -------------- -.. currentmodule:: array_api.creation_functions +.. currentmodule:: array_api .. NOTE: please keep the functions in alphabetical order diff --git a/spec/API_specification/data_type_functions.rst b/spec/API_specification/data_type_functions.rst index 7d06f919b..bb32d2b7f 100644 --- a/spec/API_specification/data_type_functions.rst +++ b/spec/API_specification/data_type_functions.rst @@ -9,7 +9,7 @@ A conforming implementation of the array API standard must provide and support t Objects in API -------------- -.. currentmodule:: array_api.data_type_functions +.. currentmodule:: array_api .. NOTE: please keep the functions in alphabetical order diff --git a/spec/API_specification/elementwise_functions.rst b/spec/API_specification/elementwise_functions.rst index 25f807ee7..02e3d50b6 100644 --- a/spec/API_specification/elementwise_functions.rst +++ b/spec/API_specification/elementwise_functions.rst @@ -19,7 +19,7 @@ A conforming implementation of the array API standard must provide and support t Objects in API -------------- -.. currentmodule:: array_api.elementwise_functions +.. currentmodule:: array_api .. NOTE: please keep the functions in alphabetical order diff --git a/spec/API_specification/indexing.rst b/spec/API_specification/indexing.rst index 73002990a..6d5e77a5b 100644 --- a/spec/API_specification/indexing.rst +++ b/spec/API_specification/indexing.rst @@ -154,7 +154,7 @@ Multi-dimensional arrays must extend the concept of single-axis indexing to mult - 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. .. note:: - Expanding dimensions can be equivalently achieved via repeated invocation of :func:`~array_api.manipulation_functions.expand_dims`. + Expanding dimensions can be equivalently achieved via repeated invocation of :func:`~array_api.expand_dims`. - 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``. @@ -181,7 +181,7 @@ Boolean Array Indexing 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)``. .. note:: - 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`. + 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`. - 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)]``. diff --git a/spec/API_specification/linear_algebra_functions.rst b/spec/API_specification/linear_algebra_functions.rst index 5900459d9..9bae18e77 100644 --- a/spec/API_specification/linear_algebra_functions.rst +++ b/spec/API_specification/linear_algebra_functions.rst @@ -12,7 +12,7 @@ A conforming implementation of the array API standard must provide and support t * Unless stated otherwise, functions must adhere to the type promotion rules defined in :ref:`type-promotion`. * Unless stated otherwise, floating-point operations must adhere to IEEE 754-2019. -.. currentmodule:: array_api.linear_algebra_functions +.. currentmodule:: array_api Objects in API -------------- diff --git a/spec/API_specification/manipulation_functions.rst b/spec/API_specification/manipulation_functions.rst index b3891f676..86ad2697f 100644 --- a/spec/API_specification/manipulation_functions.rst +++ b/spec/API_specification/manipulation_functions.rst @@ -12,7 +12,7 @@ A conforming implementation of the array API standard must provide and support t Objects in API -------------- -.. currentmodule:: array_api.manipulation_functions +.. currentmodule:: array_api .. NOTE: please keep the functions in alphabetical order diff --git a/spec/API_specification/searching_functions.rst b/spec/API_specification/searching_functions.rst index 874e2f938..bf09e4c8a 100644 --- a/spec/API_specification/searching_functions.rst +++ b/spec/API_specification/searching_functions.rst @@ -16,7 +16,7 @@ A conforming implementation of the array API standard must provide and support t Objects in API -------------- -.. currentmodule:: array_api.searching_functions +.. currentmodule:: array_api .. NOTE: please keep the functions in alphabetical order diff --git a/spec/API_specification/set_functions.rst b/spec/API_specification/set_functions.rst index be82ecc82..b7072d100 100644 --- a/spec/API_specification/set_functions.rst +++ b/spec/API_specification/set_functions.rst @@ -12,7 +12,7 @@ A conforming implementation of the array API standard must provide and support t Objects in API -------------- -.. currentmodule:: array_api.set_functions +.. currentmodule:: array_api .. NOTE: please keep the functions in alphabetical order diff --git a/spec/API_specification/sorting_functions.rst b/spec/API_specification/sorting_functions.rst index 40c86e9b4..19d7fb439 100644 --- a/spec/API_specification/sorting_functions.rst +++ b/spec/API_specification/sorting_functions.rst @@ -19,7 +19,7 @@ A conforming implementation of the array API standard must provide and support t While defining a sort order for IEEE 754 floating-point numbers is recommended in order to facilitate reproducible and consistent sort results, doing so is not currently required by this specification. -.. currentmodule:: array_api.sorting_functions +.. currentmodule:: array_api Objects in API -------------- diff --git a/spec/API_specification/statistical_functions.rst b/spec/API_specification/statistical_functions.rst index a43154075..6734506ed 100644 --- a/spec/API_specification/statistical_functions.rst +++ b/spec/API_specification/statistical_functions.rst @@ -15,7 +15,7 @@ A conforming implementation of the array API standard must provide and support t Objects in API -------------- -.. currentmodule:: array_api.statistical_functions +.. currentmodule:: array_api .. NOTE: please keep the functions in alphabetical order diff --git a/spec/API_specification/utility_functions.rst b/spec/API_specification/utility_functions.rst index 4ee4c33f8..f869b4321 100644 --- a/spec/API_specification/utility_functions.rst +++ b/spec/API_specification/utility_functions.rst @@ -15,7 +15,7 @@ A conforming implementation of the array API standard must provide and support t Objects in API -------------- -.. currentmodule:: array_api.utility_functions +.. currentmodule:: array_api .. NOTE: please keep the functions in alphabetical order diff --git a/spec/Makefile b/spec/Makefile index 8082b9728..e71fa39e1 100644 --- a/spec/Makefile +++ b/spec/Makefile @@ -22,3 +22,4 @@ help: clean: -rm -rf $(BUILDDIR) -rm -rf "$(SOURCEDIR)/API_specification/generated" + -rm -rf "$(SOURCEDIR)/extensions/generated" From d3df3fcc4761ab300827cb4d2adfb1fc7e277e96 Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Sun, 22 May 2022 16:25:31 -0700 Subject: [PATCH 4/7] Export string name --- spec/API_specification/array_api/data_types.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/API_specification/array_api/data_types.py b/spec/API_specification/array_api/data_types.py index fd00521f1..6008569f4 100644 --- a/spec/API_specification/array_api/data_types.py +++ b/spec/API_specification/array_api/data_types.py @@ -17,4 +17,4 @@ def __eq__(self: dtype, other: dtype, /) -> bool: a boolean indicating whether the data type objects are equal. """ -all = [__eq__] +all = ['__eq__'] From 73f9651624b75cd40aba19e94158651bcf51b65b Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Sun, 22 May 2022 16:34:51 -0700 Subject: [PATCH 5/7] Rename import and fix list of exports --- spec/API_specification/array_api/__init__.py | 2 +- spec/API_specification/array_api/data_types.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/API_specification/array_api/__init__.py b/spec/API_specification/array_api/__init__.py index 31d92e99c..e76643f0d 100644 --- a/spec/API_specification/array_api/__init__.py +++ b/spec/API_specification/array_api/__init__.py @@ -2,7 +2,7 @@ from .constants import * from .creation_functions import * from .data_type_functions import * -from .data_types import * +import data_types as dtype from .elementwise_functions import * from .linear_algebra_functions import * from .manipulation_functions import * diff --git a/spec/API_specification/array_api/data_types.py b/spec/API_specification/array_api/data_types.py index 6008569f4..a86c9ebe6 100644 --- a/spec/API_specification/array_api/data_types.py +++ b/spec/API_specification/array_api/data_types.py @@ -17,4 +17,4 @@ def __eq__(self: dtype, other: dtype, /) -> bool: a boolean indicating whether the data type objects are equal. """ -all = ['__eq__'] +__all__ = ['__eq__'] From 7e5f3a9600b70d55e51205b4f560599664791ca4 Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Sun, 22 May 2022 16:48:13 -0700 Subject: [PATCH 6/7] Remove import --- spec/API_specification/array_api/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/API_specification/array_api/__init__.py b/spec/API_specification/array_api/__init__.py index e76643f0d..a2d2e78c2 100644 --- a/spec/API_specification/array_api/__init__.py +++ b/spec/API_specification/array_api/__init__.py @@ -2,7 +2,7 @@ from .constants import * from .creation_functions import * from .data_type_functions import * -import data_types as dtype +# import data_types as dtype from .elementwise_functions import * from .linear_algebra_functions import * from .manipulation_functions import * From 18fb0648914e4422efd9e2c8fab9dc9b58b233d2 Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Sun, 22 May 2022 16:57:03 -0700 Subject: [PATCH 7/7] Update import --- spec/API_specification/array_api/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/API_specification/array_api/__init__.py b/spec/API_specification/array_api/__init__.py index a2d2e78c2..e5de2e49f 100644 --- a/spec/API_specification/array_api/__init__.py +++ b/spec/API_specification/array_api/__init__.py @@ -2,7 +2,7 @@ from .constants import * from .creation_functions import * from .data_type_functions import * -# import data_types as dtype +import array_api.data_types as dtype from .elementwise_functions import * from .linear_algebra_functions import * from .manipulation_functions import *