@@ -44,10 +44,9 @@ def _asarray_handle_nestable(fn: Callable) -> Callable:
44
44
45
45
@functools .wraps (fn )
46
46
def _asarray_handle_nestable_wrapper (* args , ** kwargs ):
47
- """
48
- Call `fn` with the *nestable* property of the function correctly handled. This
49
- means mapping the function to the container leaves if any containers are passed
50
- in the input.
47
+ """Call `fn` with the *nestable* property of the function correctly
48
+ handled. This means mapping the function to the container leaves if any
49
+ containers are passed in the input.
51
50
52
51
Parameters
53
52
----------
@@ -139,9 +138,9 @@ def _remove_np_bfloat16(obj):
139
138
def _asarray_to_native_arrays_and_back (fn : Callable ) -> Callable :
140
139
@functools .wraps (fn )
141
140
def _asarray_to_native_arrays_and_back_wrapper (* args , dtype = None , ** kwargs ):
142
- """
143
- Wrap `fn` so that input arrays are all converted to `ivy.NativeArray` instances
144
- and return arrays are all converted to `ivy.Array` instances.
141
+ """Wrap `fn` so that input arrays are all converted to
142
+ `ivy.NativeArray` instances and return arrays are all converted to
143
+ `ivy.Array` instances.
145
144
146
145
This wrapper is specifically for the backend implementations of
147
146
asarray.
@@ -164,10 +163,9 @@ def _asarray_to_native_arrays_and_back_wrapper(*args, dtype=None, **kwargs):
164
163
def _asarray_infer_dtype (fn : Callable ) -> Callable :
165
164
@functools .wraps (fn )
166
165
def _asarray_infer_dtype_wrapper (* args , dtype = None , ** kwargs ):
167
- """
168
- Determine the correct `dtype`, and then calls the function with the `dtype`
169
- passed explicitly. This wrapper is specifically for the backend implementations
170
- of asarray.
166
+ """Determine the correct `dtype`, and then calls the function with the
167
+ `dtype` passed explicitly. This wrapper is specifically for the backend
168
+ implementations of asarray.
171
169
172
170
Parameters
173
171
----------
@@ -222,10 +220,9 @@ def _infer_dtype(obj):
222
220
def _asarray_infer_device (fn : Callable ) -> Callable :
223
221
@functools .wraps (fn )
224
222
def _asarray_infer_device_wrapper (* args , device = None , ** kwargs ):
225
- """
226
- Determine the correct `device`, and then calls the function with the `device`
227
- passed explicitly. This wrapper is specifically for the backend implementations
228
- of asarray.
223
+ """Determine the correct `device`, and then calls the function with the
224
+ `device` passed explicitly. This wrapper is specifically for the
225
+ backend implementations of asarray.
229
226
230
227
Parameters
231
228
----------
@@ -303,9 +300,8 @@ def arange(
303
300
device : Optional [Union [ivy .Device , ivy .NativeDevice ]] = None ,
304
301
out : Optional [ivy .Array ] = None ,
305
302
) -> ivy .Array :
306
- """
307
- Return evenly spaced values within a given interval, with the spacing being
308
- specified.
303
+ """Return evenly spaced values within a given interval, with the spacing
304
+ being specified.
309
305
310
306
Values are generated within the half-open interval [start, stop) (in other words,
311
307
the interval including start but excluding stop). For integer arguments the function
@@ -415,8 +411,7 @@ def asarray(
415
411
device : Optional [Union [ivy .Device , ivy .NativeDevice ]] = None ,
416
412
out : Optional [ivy .Array ] = None ,
417
413
) -> ivy .Array :
418
- """
419
- Convert the input to an array.
414
+ """Convert the input to an array.
420
415
421
416
Parameters
422
417
----------
@@ -501,8 +496,7 @@ def zeros(
501
496
device : Optional [Union [ivy .Device , ivy .NativeDevice ]] = None ,
502
497
out : Optional [ivy .Array ] = None ,
503
498
) -> ivy .Array :
504
- """
505
- Return a new array having a specified ``shape`` and filled with zeros.
499
+ """Return a new array having a specified ``shape`` and filled with zeros.
506
500
507
501
Parameters
508
502
----------
@@ -566,8 +560,7 @@ def ones(
566
560
device : Optional [Union [ivy .Device , ivy .NativeDevice ]] = None ,
567
561
out : Optional [ivy .Array ] = None ,
568
562
) -> ivy .Array :
569
- """
570
- Return a new array having a specified ``shape`` and filled with ones.
563
+ """Return a new array having a specified ``shape`` and filled with ones.
571
564
572
565
.. note::
573
566
@@ -665,9 +658,8 @@ def full_like(
665
658
device : Optional [Union [ivy .Device , ivy .NativeDevice ]] = None ,
666
659
out : Optional [ivy .Array ] = None ,
667
660
) -> ivy .Array :
668
- """
669
- Return a new array filled with ``fill_value`` and having the same ``shape`` as an
670
- input array ``x`` .
661
+ """Return a new array filled with ``fill_value`` and having the same
662
+ ``shape`` as an input array ``x`` .
671
663
672
664
Parameters
673
665
----------
@@ -773,9 +765,8 @@ def ones_like(
773
765
device : Optional [Union [ivy .Device , ivy .NativeDevice ]] = None ,
774
766
out : Optional [ivy .Array ] = None ,
775
767
) -> ivy .Array :
776
- """
777
- Return a new array filled with ones and having the same shape as an input array
778
- ``x``.
768
+ """Return a new array filled with ones and having the same shape as an
769
+ input array ``x``.
779
770
780
771
.. note::
781
772
@@ -893,9 +884,8 @@ def zeros_like(
893
884
device : Optional [Union [ivy .Device , ivy .NativeDevice ]] = None ,
894
885
out : Optional [ivy .Array ] = None ,
895
886
) -> ivy .Array :
896
- """
897
- Return a new array filled with zeros and having the same ``shape`` as an input array
898
- ``x``.
887
+ """Return a new array filled with zeros and having the same ``shape`` as an
888
+ input array ``x``.
899
889
900
890
Parameters
901
891
----------
@@ -1006,8 +996,8 @@ def tril(
1006
996
k : int = 0 ,
1007
997
out : Optional [ivy .Array ] = None ,
1008
998
) -> ivy .Array :
1009
- """
1010
- Return the lower triangular part of a matrix (or a stack of matrices) ``x``.
999
+ """Return the lower triangular part of a matrix (or a stack of matrices)
1000
+ ``x``.
1011
1001
1012
1002
.. note::
1013
1003
@@ -1062,8 +1052,8 @@ def triu(
1062
1052
k : int = 0 ,
1063
1053
out : Optional [ivy .Array ] = None ,
1064
1054
) -> ivy .Array :
1065
- """
1066
- Return the upper triangular part of a matrix (or a stack of matrices) ``x``.
1055
+ """Return the upper triangular part of a matrix (or a stack of matrices)
1056
+ ``x``.
1067
1057
1068
1058
.. note::
1069
1059
@@ -1120,8 +1110,7 @@ def empty(
1120
1110
device : Optional [Union [ivy .Device , ivy .NativeDevice ]] = None ,
1121
1111
out : Optional [ivy .Array ] = None ,
1122
1112
) -> ivy .Array :
1123
- """
1124
- Return a new array of given shape and type, filled with zeros.
1113
+ """Return a new array of given shape and type, filled with zeros.
1125
1114
1126
1115
Parameters
1127
1116
----------
@@ -1171,8 +1160,7 @@ def empty_like(
1171
1160
device : Optional [Union [ivy .Device , ivy .NativeDevice ]] = None ,
1172
1161
out : Optional [ivy .Array ] = None ,
1173
1162
) -> ivy .Array :
1174
- """
1175
- Return an uninitialized array with the same shape as an input array x.
1163
+ """Return an uninitialized array with the same shape as an input array x.
1176
1164
1177
1165
Parameters
1178
1166
----------
@@ -1226,8 +1214,8 @@ def eye(
1226
1214
device : Optional [Union [ivy .Device , ivy .NativeDevice ]] = None ,
1227
1215
out : Optional [ivy .Array ] = None ,
1228
1216
) -> ivy .Array :
1229
- """
1230
- Return a two-dimensional array with ones on the k diagonal and zeros elsewhere.
1217
+ """Return a two-dimensional array with ones on the k diagonal and zeros
1218
+ elsewhere.
1231
1219
1232
1220
Parameters
1233
1221
----------
@@ -1369,8 +1357,8 @@ def linspace(
1369
1357
device : Optional [Union [ivy .Device , ivy .NativeDevice ]] = None ,
1370
1358
out : Optional [ivy .Array ] = None ,
1371
1359
) -> ivy .Array :
1372
- """
1373
- Generate a certain number of evenly-spaced values in an interval along a given axis.
1360
+ """Generate a certain number of evenly-spaced values in an interval along a
1361
+ given axis.
1374
1362
1375
1363
See :math:`arange` that allows to specify the step size of evenly spaced values in
1376
1364
an interval.
@@ -1472,8 +1460,7 @@ def meshgrid(
1472
1460
indexing : str = "xy" ,
1473
1461
out : Optional [ivy .Array ] = None ,
1474
1462
) -> List [ivy .Array ]:
1475
- """
1476
- Return coordinate matrices from coordinate vectors.
1463
+ """Return coordinate matrices from coordinate vectors.
1477
1464
1478
1465
Parameters
1479
1466
----------
@@ -1597,8 +1584,8 @@ def full(
1597
1584
device : Optional [Union [ivy .Device , ivy .NativeDevice ]] = None ,
1598
1585
out : Optional [ivy .Array ] = None ,
1599
1586
) -> ivy .Array :
1600
- """
1601
- Return a new array having a specified ``shape`` and filled with ``fill_value``.
1587
+ """Return a new array having a specified ``shape`` and filled with
1588
+ ``fill_value``.
1602
1589
1603
1590
Parameters
1604
1591
----------
@@ -1700,8 +1687,7 @@ def full(
1700
1687
def to_dlpack (
1701
1688
x : Union [ivy .Array , ivy .NativeArray ], / , * , out : Optional [ivy .Array ] = None
1702
1689
):
1703
- """
1704
- Return PyCapsule Object.
1690
+ """Return PyCapsule Object.
1705
1691
1706
1692
Parameters
1707
1693
----------
@@ -1740,9 +1726,8 @@ def to_dlpack(
1740
1726
def from_dlpack (
1741
1727
x : Union [ivy .Array , ivy .NativeArray ], / , * , out : Optional [ivy .Array ] = None
1742
1728
) -> ivy .Array :
1743
- """
1744
- Return a new array containing the data from another (array) object with a
1745
- ``__dlpack__`` method or PyCapsule Object.
1729
+ """Return a new array containing the data from another (array) object with
1730
+ a ``__dlpack__`` method or PyCapsule Object.
1746
1731
1747
1732
Parameters
1748
1733
----------
@@ -1798,8 +1783,7 @@ def copy_array(
1798
1783
to_ivy_array : bool = True ,
1799
1784
out : Optional [ivy .Array ] = None ,
1800
1785
) -> ivy .Array :
1801
- """
1802
- Copy an array.
1786
+ """Copy an array.
1803
1787
1804
1788
Parameters
1805
1789
----------
@@ -1904,8 +1888,7 @@ def native_array(
1904
1888
dtype : Optional [Union [ivy .Dtype , ivy .NativeDtype ]] = None ,
1905
1889
device : Optional [Union [ivy .Device , ivy .NativeDevice ]] = None ,
1906
1890
) -> ivy .NativeArray :
1907
- """
1908
- Convert the input to a native array.
1891
+ """Convert the input to a native array.
1909
1892
1910
1893
Parameters
1911
1894
----------
@@ -1969,9 +1952,9 @@ def one_hot(
1969
1952
device : Union [ivy .Device , ivy .NativeDevice ] = None ,
1970
1953
out : Optional [ivy .Array ] = None ,
1971
1954
) -> ivy .Array :
1972
- """
1973
- Return a one-hot array. The locations represented by indices in the parameter
1974
- indices take value on_value, while all other locations take value off_value.
1955
+ """Return a one-hot array. The locations represented by indices in the
1956
+ parameter indices take value on_value, while all other locations take value
1957
+ off_value.
1975
1958
1976
1959
Parameters
1977
1960
----------
@@ -2085,9 +2068,8 @@ def logspace(
2085
2068
device : Optional [Union [ivy .Device , ivy .NativeDevice ]] = None ,
2086
2069
out : Optional [ivy .Array ] = None ,
2087
2070
) -> ivy .Array :
2088
- """
2089
- Generate a certain number of evenly-spaced values in log space, in an interval along
2090
- a given axis.
2071
+ """Generate a certain number of evenly-spaced values in log space, in an
2072
+ interval along a given axis.
2091
2073
2092
2074
Parameters
2093
2075
----------
@@ -2190,8 +2172,7 @@ def frombuffer(
2190
2172
count : Optional [int ] = - 1 ,
2191
2173
offset : Optional [int ] = 0 ,
2192
2174
) -> ivy .Array :
2193
- r"""
2194
- Interpret a buffer as a 1-dimensional array.
2175
+ r"""Interpret a buffer as a 1-dimensional array.
2195
2176
2196
2177
.. note::
2197
2178
Note that either of the following must be true:
@@ -2256,16 +2237,16 @@ def triu_indices(
2256
2237
* ,
2257
2238
device : Optional [Union [ivy .Device , ivy .NativeDevice ]] = None ,
2258
2239
) -> Tuple [ivy .Array ]:
2259
- """
2260
- Return the indices of the upper triangular part of a row by col matrix in a 2-by-N
2261
- shape (tuple of two N dimensional arrays), where the first row contains row
2262
- coordinates of all indices and the second row contains column coordinates. Indices
2263
- are ordered based on rows and then columns. The upper triangular part of the matrix
2264
- is defined as the elements on and above the diagonal. The argument k controls which
2265
- diagonal to consider. If k = 0, all elements on and above the main diagonal are
2266
- retained. A positive value excludes just as many diagonals above the main diagonal,
2267
- and similarly a negative value includes just as many diagonals below the main
2268
- diagonal. The main diagonal are the set of indices {(i,i)} for i∈[0,min{n_rows,
2240
+ """Return the indices of the upper triangular part of a row by col matrix
2241
+ in a 2-by-N shape (tuple of two N dimensional arrays), where the first row
2242
+ contains row coordinates of all indices and the second row contains column
2243
+ coordinates. Indices are ordered based on rows and then columns. The upper
2244
+ triangular part of the matrix is defined as the elements on and above the
2245
+ diagonal. The argument k controls which diagonal to consider. If k = 0,
2246
+ all elements on and above the main diagonal are retained. A positive value
2247
+ excludes just as many diagonals above the main diagonal, and similarly a
2248
+ negative value includes just as many diagonals below the main diagonal. The
2249
+ main diagonal are the set of indices {(i,i)} for i∈[0,min{n_rows,
2269
2250
n_cols}−1].
2270
2251
2271
2252
Notes
0 commit comments