@@ -192,16 +192,15 @@ def allclose(a, b, rtol=1.0e-5, atol=1.0e-8, equal_nan=False):
192
192
193
193
Parameters
194
194
----------
195
- a : {dpnp.ndarray, usm_ndarray, scalar}
196
- First input array, expected to have numeric data type.
197
- Both inputs `a` and `b` can not be scalars at the same time.
198
- b : {dpnp.ndarray, usm_ndarray, scalar}
199
- Second input array, also expected to have numeric data type.
195
+ a, b : {dpnp.ndarray, usm_ndarray, scalar}
196
+ Input arrays, expected to have numeric data type.
200
197
Both inputs `a` and `b` can not be scalars at the same time.
201
198
rtol : {dpnp.ndarray, usm_ndarray, scalar}, optional
202
- The relative tolerance parameter. Default: ``1e-05``.
199
+ The relative tolerance parameter.
200
+ Default: ``1e-05``.
203
201
atol : {dpnp.ndarray, usm_ndarray, scalar}, optional
204
- The absolute tolerance parameter. Default: ``1e-08``.
202
+ The absolute tolerance parameter.
203
+ Default: ``1e-08``.
205
204
equal_nan : bool
206
205
Whether to compare ``NaNs`` as equal. If ``True``, ``NaNs`` in `a` will
207
206
be considered equal to ``NaNs`` in `b` in the output array.
@@ -213,14 +212,20 @@ def allclose(a, b, rtol=1.0e-5, atol=1.0e-8, equal_nan=False):
213
212
A 0-dim array with ``True`` value if the two arrays are equal within
214
213
the given tolerance; with ``False`` otherwise.
215
214
216
-
217
215
See Also
218
216
--------
219
217
:obj:`dpnp.isclose` : Test whether two arrays are element-wise equal.
220
218
:obj:`dpnp.all` : Test whether all elements evaluate to True.
221
219
:obj:`dpnp.any` : Test whether any element evaluates to True.
222
220
:obj:`dpnp.equal` : Return (x1 == x2) element-wise.
223
221
222
+ Notes
223
+ -----
224
+ The comparison of `a` and `b` uses standard broadcasting, which
225
+ means that `a` and `b` need not have the same shape in order for
226
+ ``dpnp.allclose(a, b)`` to evaluate to ``True``.
227
+ The same is true for :obj:`dpnp.equal` but not :obj:`dpnp.array_equal`.
228
+
224
229
Examples
225
230
--------
226
231
>>> import dpnp as np
@@ -348,11 +353,8 @@ def array_equal(a1, a2, equal_nan=False):
348
353
349
354
Parameters
350
355
----------
351
- a1 : {dpnp.ndarray, usm_ndarray, scalar}
352
- First input array.
353
- Both inputs `x1` and `x2` can not be scalars at the same time.
354
- a2 : {dpnp.ndarray, usm_ndarray, scalar}
355
- Second input array.
356
+ a1, a2 : {dpnp.ndarray, usm_ndarray, scalar}
357
+ Input arrays.
356
358
Both inputs `x1` and `x2` can not be scalars at the same time.
357
359
equal_nan : bool, optional
358
360
Whether to compare ``NaNs`` as equal. If the dtype of `a1` and `a2` is
@@ -473,11 +475,8 @@ def array_equiv(a1, a2):
473
475
474
476
Parameters
475
477
----------
476
- a1 : {dpnp.ndarray, usm_ndarray, scalar}
477
- First input array.
478
- Both inputs `x1` and `x2` can not be scalars at the same time.
479
- a2 : {dpnp.ndarray, usm_ndarray, scalar}
480
- Second input array.
478
+ a1, a2 : {dpnp.ndarray, usm_ndarray, scalar}
479
+ Input arrays.
481
480
Both inputs `x1` and `x2` can not be scalars at the same time.
482
481
483
482
Returns
@@ -532,15 +531,16 @@ def array_equiv(a1, a2):
532
531
533
532
Parameters
534
533
----------
535
- x1 : {dpnp.ndarray, usm_ndarray, scalar}
536
- First input array, expected to have numeric data type.
537
- Both inputs `x1` and `x2` can not be scalars at the same time.
538
- x2 : {dpnp.ndarray, usm_ndarray, scalar}
539
- Second input array, also expected to have numeric data type.
534
+ x1, x2 : {dpnp.ndarray, usm_ndarray, scalar}
535
+ Input arrays, expected to have numeric data type.
540
536
Both inputs `x1` and `x2` can not be scalars at the same time.
537
+ If ``x1.shape != x2.shape``, they must be broadcastable to a common shape
538
+ (which becomes the shape of the output).
541
539
out : {None, dpnp.ndarray, usm_ndarray}, optional
542
540
Output array to populate.
543
- Array have the correct shape and the expected data type.
541
+ Array must have a shape that the inputs broadcast to and
542
+ the expected data type.
543
+ Default: ``None``.
544
544
order : {"C", "F", "A", "K"}, optional
545
545
Memory layout of the newly output array, if parameter `out` is ``None``.
546
546
Default: ``"K"``.
@@ -603,15 +603,15 @@ def array_equiv(a1, a2):
603
603
604
604
Parameters
605
605
----------
606
- x1 : {dpnp.ndarray, usm_ndarray, scalar}
607
- First input array, expected to have numeric data type.
608
- Both inputs `x1` and `x2` can not be scalars at the same time.
609
- x2 : {dpnp.ndarray, usm_ndarray, scalar}
610
- Second input array, also expected to have numeric data type.
606
+ x1, x2 : {dpnp.ndarray, usm_ndarray, scalar}
607
+ Input arrays, expected to have numeric data type.
611
608
Both inputs `x1` and `x2` can not be scalars at the same time.
609
+ If ``x1.shape != x2.shape``, they must be broadcastable to a common shape
610
+ (which becomes the shape of the output).
612
611
out : {None, dpnp.ndarray, usm_ndarray}, optional
613
612
Output array to populate.
614
- Array must have the correct shape and the expected data type.
613
+ Array must have a shape that the inputs broadcast to and
614
+ the expected data type.
615
615
Default: ``None``.
616
616
order : {"C", "F", "A", "K"}, optional
617
617
Memory layout of the newly output array, if parameter `out` is ``None``.
@@ -669,15 +669,15 @@ def array_equiv(a1, a2):
669
669
670
670
Parameters
671
671
----------
672
- x1 : {dpnp.ndarray, usm_ndarray, scalar}
673
- First input array, expected to have numeric data type.
674
- Both inputs `x1` and `x2` can not be scalars at the same time.
675
- x2 : {dpnp.ndarray, usm_ndarray, scalar}
676
- Second input array, also expected to have numeric data type.
672
+ x1, x2 : {dpnp.ndarray, usm_ndarray, scalar}
673
+ Input arrays, expected to have numeric data type.
677
674
Both inputs `x1` and `x2` can not be scalars at the same time.
675
+ If ``x1.shape != x2.shape``, they must be broadcastable to a common shape
676
+ (which becomes the shape of the output).
678
677
out : {None, dpnp.ndarray, usm_ndarray}, optional
679
678
Output array to populate.
680
- Array must have the correct shape and the expected data type.
679
+ Array must have a shape that the inputs broadcast to and
680
+ the expected data type.
681
681
Default: ``None``.
682
682
order : {"C", "F", "A", "K"}, optional
683
683
Memory layout of the newly output array, if parameter `out` is ``None``.
@@ -746,16 +746,15 @@ def isclose(a, b, rtol=1e-05, atol=1e-08, equal_nan=False):
746
746
747
747
Parameters
748
748
----------
749
- a : {dpnp.ndarray, usm_ndarray, scalar}
750
- First input array, expected to have numeric data type.
751
- Both inputs `a` and `b` can not be scalars at the same time.
752
- b : {dpnp.ndarray, usm_ndarray, scalar}
753
- Second input array, also expected to have numeric data type.
749
+ a, b : {dpnp.ndarray, usm_ndarray, scalar}
750
+ Input arrays to compare, expected to have numeric data type.
754
751
Both inputs `a` and `b` can not be scalars at the same time.
755
752
rtol : {dpnp.ndarray, usm_ndarray, scalar}, optional
756
- The relative tolerance parameter. Default: ``1e-05``.
753
+ The relative tolerance parameter.
754
+ Default: ``1e-05``.
757
755
atol : {dpnp.ndarray, usm_ndarray, scalar}, optional
758
- The absolute tolerance parameter. Default: ``1e-08``.
756
+ The absolute tolerance parameter.
757
+ Default: ``1e-08``.
759
758
equal_nan : bool
760
759
Whether to compare ``NaNs`` as equal. If ``True``, ``NaNs`` in `a` will
761
760
be considered equal to ``NaNs`` in `b` in the output array.
@@ -943,7 +942,8 @@ def iscomplexobj(x):
943
942
Input array, expected to have numeric data type.
944
943
out : {None, dpnp.ndarray, usm_ndarray}, optional
945
944
Output array to populate.
946
- Array must have the correct shape and the expected data type.
945
+ Array must have a shape that the input broadcast to and
946
+ the expected data type.
947
947
Default: ``None``.
948
948
order : {"C", "F", "A", "K"}, optional
949
949
Memory layout of the newly output array, if parameter `out` is ``None``.
@@ -1073,7 +1073,8 @@ def isfortran(a):
1073
1073
Input array, expected to have numeric data type.
1074
1074
out : {None, dpnp.ndarray, usm_ndarray}, optional
1075
1075
Output array to populate.
1076
- Array must have the correct shape and the expected data type.
1076
+ Array must have a shape that the input broadcast to and
1077
+ the expected data type.
1077
1078
Default: ``None``.
1078
1079
order : {"C", "F", "A", "K"}, optional
1079
1080
Memory layout of the newly output array, if parameter `out` is ``None``.
@@ -1127,7 +1128,8 @@ def isfortran(a):
1127
1128
Input array, expected to have numeric data type.
1128
1129
out : {None, dpnp.ndarray, usm_ndarray}, optional
1129
1130
Output array to populate.
1130
- Array must have the correct shape and the expected data type.
1131
+ Array must have a shape that the input broadcast to and
1132
+ the expected data type.
1131
1133
Default: ``None``.
1132
1134
order : {"C", "F", "A", "K"}, optional
1133
1135
Memory layout of the newly output array, if parameter `out` is ``None``.
@@ -1440,15 +1442,15 @@ def isscalar(element):
1440
1442
1441
1443
Parameters
1442
1444
----------
1443
- x1 : {dpnp.ndarray, usm_ndarray, scalar}
1444
- First input array, expected to have numeric data type.
1445
- Both inputs `x1` and `x2` can not be scalars at the same time.
1446
- x2 : {dpnp.ndarray, usm_ndarray, scalar}
1447
- Second input array, also expected to have numeric data type.
1445
+ x1, x2 : {dpnp.ndarray, usm_ndarray, scalar}
1446
+ Input arrays, expected to have numeric data type.
1448
1447
Both inputs `x1` and `x2` can not be scalars at the same time.
1448
+ If ``x1.shape != x2.shape``, they must be broadcastable to a common shape
1449
+ (which becomes the shape of the output).
1449
1450
out : {None, dpnp.ndarray, usm_ndarray}, optional
1450
1451
Output array to populate.
1451
- Array must have the correct shape and the expected data type.
1452
+ Array must have a shape that the inputs broadcast to and
1453
+ the expected data type.
1452
1454
Default: ``None``.
1453
1455
order : {"C", "F", "A", "K"}, optional
1454
1456
Memory layout of the newly output array, if parameter `out` is ``None``.
@@ -1506,15 +1508,15 @@ def isscalar(element):
1506
1508
1507
1509
Parameters
1508
1510
----------
1509
- x1 : {dpnp.ndarray, usm_ndarray, scalar}
1510
- First input array, expected to have numeric data type.
1511
- Both inputs `x1` and `x2` can not be scalars at the same time.
1512
- x2 : {dpnp.ndarray, usm_ndarray, scalar}
1513
- Second input array, also expected to have numeric data type.
1511
+ x1, x2 : {dpnp.ndarray, usm_ndarray, scalar}
1512
+ Input arrays, expected to have numeric data type.
1514
1513
Both inputs `x1` and `x2` can not be scalars at the same time.
1514
+ If ``x1.shape != x2.shape``, they must be broadcastable to a common shape
1515
+ (which becomes the shape of the output).
1515
1516
out : {None, dpnp.ndarray, usm_ndarray}, optional
1516
1517
Output array to populate.
1517
- Array must have the correct shape and the expected data type.
1518
+ Array must have a shape that the inputs broadcast to and
1519
+ the expected data type.
1518
1520
Default: ``None``.
1519
1521
order : {"C", "F", "A", "K"}, optional
1520
1522
Memory layout of the newly output array, if parameter `out` is ``None``.
@@ -1572,15 +1574,15 @@ def isscalar(element):
1572
1574
1573
1575
Parameters
1574
1576
----------
1575
- x1 : {dpnp.ndarray, usm_ndarray, scalar}
1576
- First input array.
1577
- Both inputs `x1` and `x2` can not be scalars at the same time.
1578
- x2 : {dpnp.ndarray, usm_ndarray, scalar}
1579
- Second input array.
1577
+ x1, x2 : {dpnp.ndarray, usm_ndarray, scalar}
1578
+ Input arrays, expected to have numeric data type.
1580
1579
Both inputs `x1` and `x2` can not be scalars at the same time.
1580
+ If ``x1.shape != x2.shape``, they must be broadcastable to a common shape
1581
+ (which becomes the shape of the output).
1581
1582
out : {None, dpnp.ndarray, usm_ndarray}, optional
1582
1583
Output array to populate.
1583
- Array must have the correct shape and the expected data type.
1584
+ Array must have a shape that the inputs broadcast to and
1585
+ the expected data type.
1584
1586
Default: ``None``.
1585
1587
order : {"C", "F", "A", "K"}, optional
1586
1588
Memory layout of the newly output array, if parameter `out` is ``None``.
@@ -1590,6 +1592,7 @@ def isscalar(element):
1590
1592
-------
1591
1593
out : dpnp.ndarray
1592
1594
An array containing the element-wise logical AND results.
1595
+ The shape is determined by broadcasting.
1593
1596
1594
1597
Limitations
1595
1598
-----------
@@ -1643,7 +1646,8 @@ def isscalar(element):
1643
1646
Input array.
1644
1647
out : {None, dpnp.ndarray, usm_ndarray}, optional
1645
1648
Output array to populate.
1646
- Array must have the correct shape and the expected data type.
1649
+ Array must have a shape that the input broadcast to and
1650
+ the expected data type.
1647
1651
Default: ``None``.
1648
1652
order : {"C", "F", "A", "K"}, optional
1649
1653
Memory layout of the newly output array, if parameter `out` is ``None``.
@@ -1693,15 +1697,15 @@ def isscalar(element):
1693
1697
1694
1698
Parameters
1695
1699
----------
1696
- x1 : {dpnp.ndarray, usm_ndarray, scalar}
1697
- First input array.
1698
- Both inputs `x1` and `x2` can not be scalars at the same time.
1699
- x2 : {dpnp.ndarray, usm_ndarray, scalar}
1700
- Second input array.
1700
+ x1, x2 : {dpnp.ndarray, usm_ndarray, scalar}
1701
+ Input arrays, expected to have numeric data type.
1701
1702
Both inputs `x1` and `x2` can not be scalars at the same time.
1703
+ If ``x1.shape != x2.shape``, they must be broadcastable to a common shape
1704
+ (which becomes the shape of the output).
1702
1705
out : {None, dpnp.ndarray, usm_ndarray}, optional
1703
1706
Output array to populate.
1704
- Array must have the correct shape and the expected data type.
1707
+ Array must have a shape that the inputs broadcast to and
1708
+ the expected data type.
1705
1709
Default: ``None``.
1706
1710
order : {"C", "F", "A", "K"}, optional
1707
1711
Memory layout of the newly output array, if parameter `out` is ``None``.
@@ -1711,6 +1715,7 @@ def isscalar(element):
1711
1715
-------
1712
1716
out : dpnp.ndarray
1713
1717
An array containing the element-wise logical OR results.
1718
+ The shape is determined by broadcasting.
1714
1719
1715
1720
Limitations
1716
1721
-----------
@@ -1761,15 +1766,15 @@ def isscalar(element):
1761
1766
1762
1767
Parameters
1763
1768
----------
1764
- x1 : {dpnp.ndarray, usm_ndarray, scalar}
1765
- First input array.
1766
- Both inputs `x1` and `x2` can not be scalars at the same time.
1767
- x2 : {dpnp.ndarray, usm_ndarray, scalar}
1768
- Second input array.
1769
+ x1, x2 : {dpnp.ndarray, usm_ndarray, scalar}
1770
+ Input arrays, expected to have numeric data type.
1769
1771
Both inputs `x1` and `x2` can not be scalars at the same time.
1772
+ If ``x1.shape != x2.shape``, they must be broadcastable to a common shape
1773
+ (which becomes the shape of the output).
1770
1774
out : {None, dpnp.ndarray, usm_ndarray}, optional
1771
1775
Output array to populate.
1772
- Array must have the correct shape and the expected data type.
1776
+ Array must have a shape that the inputs broadcast to and
1777
+ the expected data type.
1773
1778
Default: ``None``.
1774
1779
order : {"C", "F", "A", "K"}, optional
1775
1780
Memory layout of the newly output array, if parameter `out` is ``None``.
@@ -1779,6 +1784,7 @@ def isscalar(element):
1779
1784
-------
1780
1785
out : dpnp.ndarray
1781
1786
An array containing the element-wise logical XOR results.
1787
+ The shape is determined by broadcasting.
1782
1788
1783
1789
Limitations
1784
1790
-----------
@@ -1827,15 +1833,15 @@ def isscalar(element):
1827
1833
1828
1834
Parameters
1829
1835
----------
1830
- x1 : {dpnp.ndarray, usm_ndarray, scalar}
1831
- First input array, expected to have numeric data type.
1832
- Both inputs `x1` and `x2` can not be scalars at the same time.
1833
- x2 : {dpnp.ndarray, usm_ndarray, scalar}
1834
- Second input array, also expected to have numeric data type.
1836
+ x1, x2 : {dpnp.ndarray, usm_ndarray, scalar}
1837
+ Input arrays, expected to have numeric data type.
1835
1838
Both inputs `x1` and `x2` can not be scalars at the same time.
1839
+ If ``x1.shape != x2.shape``, they must be broadcastable to a common shape
1840
+ (which becomes the shape of the output).
1836
1841
out : {None, dpnp.ndarray, usm_ndarray}, optional
1837
1842
Output array to populate.
1838
- Array must have the correct shape and the expected data type.
1843
+ Array must have a shape that the inputs broadcast to and
1844
+ the expected data type.
1839
1845
Default: ``None``.
1840
1846
order : {"C", "F", "A", "K"}, optional
1841
1847
Memory layout of the newly output array, if parameter `out` is ``None``.
0 commit comments