Skip to content

Commit 35c30b9

Browse files
committed
Add missing notes section
1 parent d1409cc commit 35c30b9

11 files changed

+181
-7
lines changed

src/array_api_stubs/_draft/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,4 @@
2121
__array_api_version__: str = "YYYY.MM"
2222
"""
2323
String representing the version of the array API specification which the conforming implementation adheres to.
24-
25-
.. versionadded:: 2022.12
2624
"""

src/array_api_stubs/_draft/array_object.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,8 @@ def __abs__(self: array, /) -> array:
139139
.. note::
140140
Element-wise results, including special cases, must equal the results returned by the equivalent element-wise function :func:`~array_api.abs`.
141141
142+
Notes
143+
-----
142144
143145
.. versionchanged:: 2022.12
144146
Added complex data type support.
@@ -160,6 +162,8 @@ def __add__(self: array, other: Union[int, float, array], /) -> array:
160162
out: array
161163
an array containing the element-wise sums. The returned array must have a data type determined by :ref:`type-promotion`.
162164
165+
Notes
166+
-----
163167
164168
.. note::
165169
Element-wise results, including special cases, must equal the results returned by the equivalent element-wise function :func:`~array_api.add`.
@@ -337,6 +341,9 @@ def __dlpack__(
337341
errors are raised when export fails for other reasons (e.g., incorrect
338342
arguments passed or out of memory).
339343
344+
Notes
345+
-----
346+
340347
.. versionchanged:: 2022.12
341348
Added BufferError.
342349
"""
@@ -690,6 +697,8 @@ def __matmul__(self: array, other: array, /) -> array:
690697
- if either ``self`` or ``other`` has more than two dimensions, an array having a shape determined by :ref:`broadcasting` ``shape(self)[:-2]`` against ``shape(other)[:-2]`` and containing the `conventional matrix product <https://en.wikipedia.org/wiki/Matrix_multiplication>`_ for each stacked matrix.
691698
- The returned array must have a data type determined by :ref:`type-promotion`.
692699
700+
Notes
701+
-----
693702
694703
.. note::
695704
Results must equal the results returned by the equivalent function :func:`~array_api.matmul`.
@@ -749,6 +758,8 @@ def __mul__(self: array, other: Union[int, float, array], /) -> array:
749758
out: array
750759
an array containing the element-wise products. The returned array must have a data type determined by :ref:`type-promotion`.
751760
761+
Notes
762+
-----
752763
753764
.. note::
754765
Element-wise results, including special cases, must equal the results returned by the equivalent element-wise function :func:`~array_api.multiply`.
@@ -774,6 +785,9 @@ def __ne__(self: array, other: Union[int, float, bool, array], /) -> array:
774785
an array containing the element-wise results. The returned array must have a data type of ``bool`` (i.e., must be a boolean array).
775786
776787
788+
Notes
789+
-----
790+
777791
.. note::
778792
Element-wise results, including special cases, must equal the results returned by the equivalent element-wise function :func:`~array_api.not_equal`.
779793
@@ -801,6 +815,8 @@ def __neg__(self: array, /) -> array:
801815
out: array
802816
an array containing the evaluated result for each element in ``self``. The returned array must have a data type determined by :ref:`type-promotion`.
803817
818+
Notes
819+
-----
804820
805821
.. note::
806822
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.negative`.
@@ -844,6 +860,8 @@ def __pos__(self: array, /) -> array:
844860
out: array
845861
an array containing the evaluated result for each element. The returned array must have the same data type as ``self``.
846862
863+
Notes
864+
-----
847865
848866
.. note::
849867
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.positive`.
@@ -873,6 +891,8 @@ def __pow__(self: array, other: Union[int, float, array], /) -> array:
873891
out: array
874892
an array containing the element-wise results. The returned array must have a data type determined by :ref:`type-promotion`.
875893
894+
Notes
895+
-----
876896
877897
.. note::
878898
Element-wise results, including special cases, must equal the results returned by the equivalent element-wise function :func:`~array_api.pow`.
@@ -950,6 +970,8 @@ def __sub__(self: array, other: Union[int, float, array], /) -> array:
950970
out: array
951971
an array containing the element-wise differences. The returned array must have a data type determined by :ref:`type-promotion`.
952972
973+
Notes
974+
-----
953975
954976
.. note::
955977
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.subtract`.
@@ -979,6 +1001,8 @@ def __truediv__(self: array, other: Union[int, float, array], /) -> array:
9791001
out: array
9801002
an array containing the element-wise results. The returned array should have a floating-point data type determined by :ref:`type-promotion`.
9811003
1004+
Notes
1005+
-----
9821006
9831007
.. note::
9841008
Element-wise results, including special cases, must equal the results returned by the equivalent element-wise function :func:`~array_api.divide`.

src/array_api_stubs/_draft/data_type_functions.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ def astype(x: array, dtype: dtype, /, *, copy: bool = True) -> array:
3737
out: array
3838
an array having the specified data type. The returned array must have the same shape as ``x``.
3939
40+
Notes
41+
-----
42+
4043
.. versionchanged:: 2022.12
4144
Added complex data type support.
4245
"""
@@ -103,6 +106,9 @@ def finfo(type: Union[dtype, array], /) -> finfo_object:
103106
104107
.. versionadded:: 2022.12
105108
109+
Notes
110+
-----
111+
106112
.. versionchanged:: 2022.12
107113
Added complex data type support.
108114
"""
@@ -178,6 +184,9 @@ def isdtype(
178184
out: bool
179185
boolean indicating whether a provided dtype is of a specified data type kind.
180186
187+
Notes
188+
-----
189+
181190
.. versionadded:: 2022.12
182191
"""
183192

src/array_api_stubs/_draft/elementwise_functions.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -734,6 +734,9 @@ def conj(x: array, /) -> array:
734734
out: array
735735
an array containing the element-wise results. The returned array must have the same data type as ``x``.
736736
737+
Notes
738+
-----
739+
737740
.. versionadded:: 2022.12
738741
"""
739742

@@ -1237,6 +1240,9 @@ def imag(x: array, /) -> array:
12371240
out: array
12381241
an array containing the element-wise results. The returned array must have a floating-point data type with the same floating-point precision as ``x`` (e.g., if ``x`` is ``complex64``, the returned array must have the floating-point data type ``float32``).
12391242
1243+
Notes
1244+
-----
1245+
12401246
.. versionadded:: 2022.12
12411247
"""
12421248

@@ -1796,6 +1802,9 @@ def negative(x: array, /) -> array:
17961802
out: array
17971803
an array containing the evaluated result for each element in ``x``. The returned array must have a data type determined by :ref:`type-promotion`.
17981804
1805+
Notes
1806+
-----
1807+
17991808
.. versionchanged:: 2022.12
18001809
Added complex data type support.
18011810
"""
@@ -1857,6 +1866,9 @@ def positive(x: array, /) -> array:
18571866
out: array
18581867
an array containing the evaluated result for each element in ``x``. The returned array must have the same data type as ``x``.
18591868
1869+
Notes
1870+
-----
1871+
18601872
.. versionchanged:: 2022.12
18611873
Added complex data type support.
18621874
"""
@@ -1946,6 +1958,9 @@ def real(x: array, /) -> array:
19461958
out: array
19471959
an array containing the element-wise results. The returned array must have a floating-point data type with the same floating-point precision as ``x`` (e.g., if ``x`` is ``complex64``, the returned array must have the floating-point data type ``float32``).
19481960
1961+
Notes
1962+
-----
1963+
19491964
.. versionadded:: 2022.12
19501965
"""
19511966

@@ -2312,6 +2327,9 @@ def subtract(x1: array, x2: array, /) -> array:
23122327
out: array
23132328
an array containing the element-wise differences. The returned array must have a data type determined by :ref:`type-promotion`.
23142329
2330+
Notes
2331+
-----
2332+
23152333
.. versionchanged:: 2022.12
23162334
Added complex data type support.
23172335
"""

src/array_api_stubs/_draft/fft.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ def fft(
4545
out: array
4646
an array transformed along the axis (dimension) indicated by ``axis``. The returned array must have a complex floating-point data type determined by :ref:`type-promotion`.
4747
48+
Notes
49+
-----
50+
4851
.. versionadded:: 2022.12
4952
"""
5053

@@ -93,6 +96,9 @@ def ifft(
9396
out: array
9497
an array transformed along the axis (dimension) indicated by ``axis``. The returned array must have a complex floating-point data type determined by :ref:`type-promotion`.
9598
99+
Notes
100+
-----
101+
96102
.. versionadded:: 2022.12
97103
"""
98104

@@ -148,6 +154,9 @@ def fftn(
148154
out: array
149155
an array transformed along the axes (dimension) indicated by ``axes``. The returned array must have a complex floating-point data type determined by :ref:`type-promotion`.
150156
157+
Notes
158+
-----
159+
151160
.. versionadded:: 2022.12
152161
"""
153162

@@ -203,6 +212,9 @@ def ifftn(
203212
out: array
204213
an array transformed along the axes (dimension) indicated by ``axes``. The returned array must have a complex floating-point data type determined by :ref:`type-promotion`.
205214
215+
Notes
216+
-----
217+
206218
.. versionadded:: 2022.12
207219
"""
208220

@@ -251,6 +263,9 @@ def rfft(
251263
out: array
252264
an array transformed along the axis (dimension) indicated by ``axis``. The returned array must have a complex-valued floating-point data type determined by :ref:`type-promotion`.
253265
266+
Notes
267+
-----
268+
254269
.. versionadded:: 2022.12
255270
"""
256271

@@ -299,6 +314,9 @@ def irfft(
299314
out: array
300315
an array transformed along the axis (dimension) indicated by ``axis``. The returned array must have a real-valued floating-point data type determined by :ref:`type-promotion`. The length along the transformed axis is ``n`` (if given) or ``2*(m-1)`` (otherwise).
301316
317+
Notes
318+
-----
319+
302320
.. versionadded:: 2022.12
303321
"""
304322

@@ -354,6 +372,9 @@ def rfftn(
354372
out: array
355373
an array transformed along the axes (dimension) indicated by ``axes``. The returned array must have a complex-valued floating-point data type determined by :ref:`type-promotion`.
356374
375+
Notes
376+
-----
377+
357378
.. versionadded:: 2022.12
358379
"""
359380

@@ -409,6 +430,9 @@ def irfftn(
409430
out: array
410431
an array transformed along the axes (dimension) indicated by ``axes``. The returned array must have a real-valued floating-point data type determined by :ref:`type-promotion`. The length along the last transformed axis is ``s[-1]`` (if given) or ``2*(m - 1)`` (otherwise), and all other axes ``s[i]``.
411432
433+
Notes
434+
-----
435+
412436
.. versionadded:: 2022.12
413437
"""
414438

@@ -454,6 +478,9 @@ def hfft(
454478
out: array
455479
an array transformed along the axis (dimension) indicated by ``axis``. The returned array must have a real-valued floating-point data type determined by :ref:`type-promotion`.
456480
481+
Notes
482+
-----
483+
457484
.. versionadded:: 2022.12
458485
"""
459486

@@ -499,6 +526,9 @@ def ihfft(
499526
out: array
500527
an array transformed along the axis (dimension) indicated by ``axis``. The returned array must have a complex-valued floating-point data type determined by :ref:`type-promotion`.
501528
529+
Notes
530+
-----
531+
502532
.. versionadded:: 2022.12
503533
"""
504534

@@ -528,6 +558,9 @@ def fftfreq(n: int, /, *, d: float = 1.0, device: Optional[device] = None) -> ar
528558
out: array
529559
an array of length ``n`` containing the sample frequencies. The returned array must have a real-valued floating-point data type determined by :ref:`type-promotion`.
530560
561+
Notes
562+
-----
563+
531564
.. versionadded:: 2022.12
532565
"""
533566

@@ -559,6 +592,9 @@ def rfftfreq(n: int, /, *, d: float = 1.0, device: Optional[device] = None) -> a
559592
out: array
560593
an array of length ``n//2+1`` containing the sample frequencies. The returned array must have a real-valued floating-point data type determined by :ref:`type-promotion`.
561594
595+
Notes
596+
-----
597+
562598
.. versionadded:: 2022.12
563599
"""
564600

@@ -584,6 +620,9 @@ def fftshift(x: array, /, *, axes: Union[int, Sequence[int]] = None) -> array:
584620
out: array
585621
the shifted array. The returned array must have the same data type as ``x``.
586622
623+
Notes
624+
-----
625+
587626
.. versionadded:: 2022.12
588627
"""
589628

@@ -607,6 +646,9 @@ def ifftshift(x: array, /, *, axes: Union[int, Sequence[int]] = None) -> array:
607646
out: array
608647
the shifted array. The returned array must have the same data type as ``x``.
609648
649+
Notes
650+
-----
651+
610652
.. versionadded:: 2022.12
611653
"""
612654

src/array_api_stubs/_draft/indexing_functions.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ def take(x: array, indices: array, /, *, axis: int) -> array:
2424
out: array
2525
an array having the same data type as ``x``. The output array must have the same rank (i.e., number of dimensions) as ``x`` and must have the same shape as ``x``, except for the axis specified by ``axis`` whose size must equal the number of elements in ``indices``.
2626
27+
Notes
28+
-----
29+
2730
.. versionadded:: 2022.12
2831
"""
2932

0 commit comments

Comments
 (0)