pyrefly-numpy-stubs 1.3.0.dev4__py3-none-any.whl → 1.4.0.dev1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- numpy-stubs/__init__.pyi +1299 -125
- numpy-stubs/_shapes.pyi +62 -1
- numpy-stubs/linalg/__init__.pyi +61 -2
- numpy-stubs/random/__init__.pyi +74 -0
- {pyrefly_numpy_stubs-1.3.0.dev4.dist-info → pyrefly_numpy_stubs-1.4.0.dev1.dist-info}/METADATA +12 -2
- pyrefly_numpy_stubs-1.4.0.dev1.dist-info/RECORD +9 -0
- {pyrefly_numpy_stubs-1.3.0.dev4.dist-info → pyrefly_numpy_stubs-1.4.0.dev1.dist-info}/WHEEL +1 -1
- pyrefly_numpy_stubs-1.3.0.dev4.dist-info/RECORD +0 -9
- {pyrefly_numpy_stubs-1.3.0.dev4.dist-info → pyrefly_numpy_stubs-1.4.0.dev1.dist-info}/licenses/LICENSE +0 -0
numpy-stubs/__init__.pyi
CHANGED
|
@@ -3,18 +3,412 @@
|
|
|
3
3
|
# This source code is licensed under the MIT license found in the
|
|
4
4
|
# LICENSE file in the root directory of this source tree.
|
|
5
5
|
|
|
6
|
-
from
|
|
6
|
+
from builtins import bool as py_bool
|
|
7
|
+
from collections.abc import Iterator, Sequence
|
|
7
8
|
from types import EllipsisType
|
|
8
|
-
from typing import Any, Literal, overload
|
|
9
|
+
from typing import Any, Final, Literal, overload, SupportsIndex
|
|
9
10
|
|
|
10
11
|
import shape_extensions
|
|
11
|
-
from numpy.
|
|
12
|
-
|
|
12
|
+
from numpy.__config__ import (
|
|
13
|
+
show as show_config,
|
|
14
|
+
)
|
|
15
|
+
from numpy._array_api_info import (
|
|
16
|
+
__array_namespace_info__ as __array_namespace_info__,
|
|
17
|
+
)
|
|
18
|
+
from numpy._core._asarray import (
|
|
19
|
+
require as require,
|
|
20
|
+
)
|
|
21
|
+
from numpy._core._type_aliases import (
|
|
22
|
+
sctypeDict as sctypeDict,
|
|
23
|
+
)
|
|
24
|
+
from numpy._core._ufunc_config import (
|
|
25
|
+
errstate as errstate,
|
|
26
|
+
getbufsize as getbufsize,
|
|
27
|
+
geterr as geterr,
|
|
28
|
+
geterrcall as geterrcall,
|
|
29
|
+
setbufsize as setbufsize,
|
|
30
|
+
seterr as seterr,
|
|
31
|
+
seterrcall as seterrcall,
|
|
32
|
+
)
|
|
33
|
+
from numpy._core.arrayprint import (
|
|
34
|
+
array2string as array2string,
|
|
35
|
+
array_repr as array_repr,
|
|
36
|
+
array_str as array_str,
|
|
37
|
+
format_float_positional as format_float_positional,
|
|
38
|
+
format_float_scientific as format_float_scientific,
|
|
39
|
+
get_printoptions as get_printoptions,
|
|
40
|
+
printoptions as printoptions,
|
|
41
|
+
set_printoptions as set_printoptions,
|
|
42
|
+
)
|
|
43
|
+
from numpy._core.einsumfunc import (
|
|
44
|
+
einsum as einsum,
|
|
45
|
+
einsum_path as einsum_path,
|
|
46
|
+
)
|
|
47
|
+
from numpy._core.fromnumeric import (
|
|
48
|
+
all as all,
|
|
49
|
+
amax as amax,
|
|
50
|
+
amin as amin,
|
|
51
|
+
any as any,
|
|
52
|
+
argmax as argmax,
|
|
53
|
+
argpartition as argpartition,
|
|
54
|
+
argsort as argsort,
|
|
55
|
+
around as around,
|
|
56
|
+
choose as choose,
|
|
57
|
+
compress as compress,
|
|
58
|
+
cumprod as cumprod,
|
|
59
|
+
cumsum as cumsum,
|
|
60
|
+
cumulative_prod as cumulative_prod,
|
|
61
|
+
cumulative_sum as cumulative_sum,
|
|
62
|
+
diagonal as diagonal,
|
|
63
|
+
matrix_transpose as matrix_transpose,
|
|
64
|
+
ndim as ndim,
|
|
65
|
+
nonzero as nonzero,
|
|
66
|
+
partition as partition,
|
|
67
|
+
prod as prod,
|
|
68
|
+
ptp as ptp,
|
|
69
|
+
put as put,
|
|
70
|
+
ravel as ravel,
|
|
71
|
+
repeat as repeat,
|
|
72
|
+
reshape as reshape,
|
|
73
|
+
resize as resize,
|
|
74
|
+
searchsorted as searchsorted,
|
|
75
|
+
shape as shape,
|
|
76
|
+
size as size,
|
|
77
|
+
sort as sort,
|
|
78
|
+
squeeze as squeeze,
|
|
79
|
+
std as std,
|
|
80
|
+
swapaxes as swapaxes,
|
|
81
|
+
take as take,
|
|
82
|
+
trace as trace,
|
|
83
|
+
transpose as transpose,
|
|
84
|
+
var as var,
|
|
85
|
+
)
|
|
86
|
+
from numpy._core.function_base import (
|
|
87
|
+
geomspace as geomspace,
|
|
88
|
+
linspace as linspace,
|
|
89
|
+
logspace as logspace,
|
|
90
|
+
)
|
|
91
|
+
from numpy._core.getlimits import (
|
|
92
|
+
finfo as finfo,
|
|
93
|
+
iinfo as iinfo,
|
|
94
|
+
)
|
|
95
|
+
from numpy._core.memmap import (
|
|
96
|
+
memmap as memmap,
|
|
97
|
+
)
|
|
98
|
+
from numpy._core.multiarray import (
|
|
99
|
+
array as array,
|
|
100
|
+
asanyarray as asanyarray,
|
|
101
|
+
asarray as asarray,
|
|
102
|
+
ascontiguousarray as ascontiguousarray,
|
|
103
|
+
asfortranarray as asfortranarray,
|
|
104
|
+
bincount as bincount,
|
|
105
|
+
busday_count as busday_count,
|
|
106
|
+
busday_offset as busday_offset,
|
|
107
|
+
busdaycalendar as busdaycalendar,
|
|
108
|
+
can_cast as can_cast,
|
|
109
|
+
concatenate as concatenate,
|
|
110
|
+
copyto as copyto,
|
|
111
|
+
datetime_as_string as datetime_as_string,
|
|
112
|
+
datetime_data as datetime_data,
|
|
113
|
+
dot as dot,
|
|
114
|
+
empty_like as empty_like,
|
|
115
|
+
flatiter as flatiter,
|
|
116
|
+
frombuffer as frombuffer,
|
|
117
|
+
fromfile as fromfile,
|
|
118
|
+
fromiter as fromiter,
|
|
119
|
+
frompyfunc as frompyfunc,
|
|
120
|
+
fromstring as fromstring,
|
|
121
|
+
inner as inner,
|
|
122
|
+
is_busday as is_busday,
|
|
123
|
+
lexsort as lexsort,
|
|
124
|
+
may_share_memory as may_share_memory,
|
|
125
|
+
min_scalar_type as min_scalar_type,
|
|
126
|
+
nditer as nditer,
|
|
127
|
+
nested_iters as nested_iters,
|
|
128
|
+
packbits as packbits,
|
|
129
|
+
promote_types as promote_types,
|
|
130
|
+
putmask as putmask,
|
|
131
|
+
result_type as result_type,
|
|
132
|
+
shares_memory as shares_memory,
|
|
133
|
+
unpackbits as unpackbits,
|
|
134
|
+
vdot as vdot,
|
|
135
|
+
where as where,
|
|
136
|
+
)
|
|
137
|
+
from numpy._core.numeric import (
|
|
138
|
+
allclose as allclose,
|
|
139
|
+
argwhere as argwhere,
|
|
140
|
+
array_equal as array_equal,
|
|
141
|
+
array_equiv as array_equiv,
|
|
142
|
+
astype as astype,
|
|
143
|
+
base_repr as base_repr,
|
|
144
|
+
binary_repr as binary_repr,
|
|
145
|
+
convolve as convolve,
|
|
146
|
+
correlate as correlate,
|
|
147
|
+
count_nonzero as count_nonzero,
|
|
148
|
+
cross as cross,
|
|
149
|
+
flatnonzero as flatnonzero,
|
|
150
|
+
fromfunction as fromfunction,
|
|
151
|
+
full_like as full_like,
|
|
152
|
+
indices as indices,
|
|
153
|
+
isclose as isclose,
|
|
154
|
+
isfortran as isfortran,
|
|
155
|
+
isscalar as isscalar,
|
|
156
|
+
moveaxis as moveaxis,
|
|
157
|
+
ones_like as ones_like,
|
|
158
|
+
outer as outer,
|
|
159
|
+
roll as roll,
|
|
160
|
+
rollaxis as rollaxis,
|
|
161
|
+
tensordot as tensordot,
|
|
162
|
+
zeros_like as zeros_like,
|
|
163
|
+
)
|
|
164
|
+
from numpy._core.numerictypes import (
|
|
165
|
+
isdtype as isdtype,
|
|
166
|
+
issubdtype as issubdtype,
|
|
167
|
+
ScalarType as ScalarType,
|
|
168
|
+
typecodes as typecodes,
|
|
169
|
+
)
|
|
170
|
+
from numpy._core.records import (
|
|
171
|
+
recarray as recarray,
|
|
172
|
+
record as record,
|
|
173
|
+
)
|
|
174
|
+
from numpy._core.shape_base import (
|
|
175
|
+
atleast_1d as atleast_1d,
|
|
176
|
+
atleast_2d as atleast_2d,
|
|
177
|
+
atleast_3d as atleast_3d,
|
|
178
|
+
block as block,
|
|
179
|
+
hstack as hstack,
|
|
180
|
+
unstack as unstack,
|
|
181
|
+
vstack as vstack,
|
|
182
|
+
)
|
|
183
|
+
from numpy._pytesttester import PytestTester
|
|
184
|
+
from numpy._shapes import (
|
|
185
|
+
diag_extent,
|
|
186
|
+
matmul_shape,
|
|
187
|
+
matvec_shape,
|
|
188
|
+
reduce_shape,
|
|
189
|
+
stack_shape,
|
|
190
|
+
vecdot_shape,
|
|
191
|
+
vecmat_shape,
|
|
192
|
+
)
|
|
193
|
+
from numpy._typing import ArrayLike
|
|
194
|
+
from numpy._typing._extended_precision import (
|
|
195
|
+
complex256 as complex256,
|
|
196
|
+
float128 as float128,
|
|
197
|
+
)
|
|
198
|
+
from numpy.lib import (
|
|
199
|
+
scimath as emath,
|
|
200
|
+
)
|
|
201
|
+
from numpy.lib._arraypad_impl import (
|
|
202
|
+
pad as pad,
|
|
203
|
+
)
|
|
204
|
+
from numpy.lib._arraysetops_impl import (
|
|
205
|
+
ediff1d as ediff1d,
|
|
206
|
+
intersect1d as intersect1d,
|
|
207
|
+
isin as isin,
|
|
208
|
+
setdiff1d as setdiff1d,
|
|
209
|
+
setxor1d as setxor1d,
|
|
210
|
+
union1d as union1d,
|
|
211
|
+
unique as unique,
|
|
212
|
+
unique_all as unique_all,
|
|
213
|
+
unique_counts as unique_counts,
|
|
214
|
+
unique_inverse as unique_inverse,
|
|
215
|
+
unique_values as unique_values,
|
|
216
|
+
)
|
|
217
|
+
from numpy.lib._function_base_impl import (
|
|
218
|
+
angle as angle,
|
|
219
|
+
append as append,
|
|
220
|
+
asarray_chkfinite as asarray_chkfinite,
|
|
221
|
+
average as average,
|
|
222
|
+
bartlett as bartlett,
|
|
223
|
+
blackman as blackman,
|
|
224
|
+
copy as copy,
|
|
225
|
+
corrcoef as corrcoef,
|
|
226
|
+
cov as cov,
|
|
227
|
+
delete as delete,
|
|
228
|
+
diff as diff,
|
|
229
|
+
digitize as digitize,
|
|
230
|
+
extract as extract,
|
|
231
|
+
flip as flip,
|
|
232
|
+
gradient as gradient,
|
|
233
|
+
hamming as hamming,
|
|
234
|
+
hanning as hanning,
|
|
235
|
+
i0 as i0,
|
|
236
|
+
insert as insert,
|
|
237
|
+
interp as interp,
|
|
238
|
+
iterable as iterable,
|
|
239
|
+
kaiser as kaiser,
|
|
240
|
+
median as median,
|
|
241
|
+
meshgrid as meshgrid,
|
|
242
|
+
percentile as percentile,
|
|
243
|
+
piecewise as piecewise,
|
|
244
|
+
place as place,
|
|
245
|
+
quantile as quantile,
|
|
246
|
+
rot90 as rot90,
|
|
247
|
+
select as select,
|
|
248
|
+
sinc as sinc,
|
|
249
|
+
sort_complex as sort_complex,
|
|
250
|
+
trapezoid as trapezoid,
|
|
251
|
+
trim_zeros as trim_zeros,
|
|
252
|
+
unwrap as unwrap,
|
|
253
|
+
vectorize as vectorize,
|
|
254
|
+
)
|
|
255
|
+
from numpy.lib._histograms_impl import (
|
|
256
|
+
histogram as histogram,
|
|
257
|
+
histogram_bin_edges as histogram_bin_edges,
|
|
258
|
+
histogramdd as histogramdd,
|
|
259
|
+
)
|
|
260
|
+
from numpy.lib._index_tricks_impl import (
|
|
261
|
+
c_ as c_,
|
|
262
|
+
diag_indices as diag_indices,
|
|
263
|
+
diag_indices_from as diag_indices_from,
|
|
264
|
+
index_exp as index_exp,
|
|
265
|
+
ix_ as ix_,
|
|
266
|
+
mgrid as mgrid,
|
|
267
|
+
ndenumerate as ndenumerate,
|
|
268
|
+
ndindex as ndindex,
|
|
269
|
+
ogrid as ogrid,
|
|
270
|
+
r_ as r_,
|
|
271
|
+
ravel_multi_index as ravel_multi_index,
|
|
272
|
+
s_ as s_,
|
|
273
|
+
unravel_index as unravel_index,
|
|
274
|
+
)
|
|
275
|
+
from numpy.lib._nanfunctions_impl import (
|
|
276
|
+
nanargmax as nanargmax,
|
|
277
|
+
nanargmin as nanargmin,
|
|
278
|
+
nancumprod as nancumprod,
|
|
279
|
+
nancumsum as nancumsum,
|
|
280
|
+
nanmax as nanmax,
|
|
281
|
+
nanmean as nanmean,
|
|
282
|
+
nanmedian as nanmedian,
|
|
283
|
+
nanmin as nanmin,
|
|
284
|
+
nanpercentile as nanpercentile,
|
|
285
|
+
nanprod as nanprod,
|
|
286
|
+
nanquantile as nanquantile,
|
|
287
|
+
nanstd as nanstd,
|
|
288
|
+
nansum as nansum,
|
|
289
|
+
nanvar as nanvar,
|
|
290
|
+
)
|
|
291
|
+
from numpy.lib._npyio_impl import (
|
|
292
|
+
fromregex as fromregex,
|
|
293
|
+
genfromtxt as genfromtxt,
|
|
294
|
+
load as load,
|
|
295
|
+
loadtxt as loadtxt,
|
|
296
|
+
save as save,
|
|
297
|
+
savetxt as savetxt,
|
|
298
|
+
savez as savez,
|
|
299
|
+
savez_compressed as savez_compressed,
|
|
300
|
+
)
|
|
301
|
+
from numpy.lib._polynomial_impl import (
|
|
302
|
+
poly as poly,
|
|
303
|
+
poly1d as poly1d,
|
|
304
|
+
polyadd as polyadd,
|
|
305
|
+
polyder as polyder,
|
|
306
|
+
polydiv as polydiv,
|
|
307
|
+
polyfit as polyfit,
|
|
308
|
+
polyint as polyint,
|
|
309
|
+
polymul as polymul,
|
|
310
|
+
polysub as polysub,
|
|
311
|
+
polyval as polyval,
|
|
312
|
+
roots as roots,
|
|
313
|
+
)
|
|
314
|
+
from numpy.lib._shape_base_impl import (
|
|
315
|
+
apply_along_axis as apply_along_axis,
|
|
316
|
+
apply_over_axes as apply_over_axes,
|
|
317
|
+
array_split as array_split,
|
|
318
|
+
column_stack as column_stack,
|
|
319
|
+
dsplit as dsplit,
|
|
320
|
+
dstack as dstack,
|
|
321
|
+
hsplit as hsplit,
|
|
322
|
+
kron as kron,
|
|
323
|
+
put_along_axis as put_along_axis,
|
|
324
|
+
split as split,
|
|
325
|
+
take_along_axis as take_along_axis,
|
|
326
|
+
tile as tile,
|
|
327
|
+
vsplit as vsplit,
|
|
328
|
+
)
|
|
329
|
+
from numpy.lib._stride_tricks_impl import (
|
|
330
|
+
broadcast_arrays as broadcast_arrays,
|
|
331
|
+
broadcast_shapes as broadcast_shapes,
|
|
332
|
+
broadcast_to as broadcast_to,
|
|
333
|
+
)
|
|
334
|
+
from numpy.lib._twodim_base_impl import (
|
|
335
|
+
diagflat as diagflat,
|
|
336
|
+
fliplr as fliplr,
|
|
337
|
+
flipud as flipud,
|
|
338
|
+
histogram2d as histogram2d,
|
|
339
|
+
mask_indices as mask_indices,
|
|
340
|
+
tri as tri,
|
|
341
|
+
tril as tril,
|
|
342
|
+
tril_indices as tril_indices,
|
|
343
|
+
tril_indices_from as tril_indices_from,
|
|
344
|
+
triu as triu,
|
|
345
|
+
triu_indices as triu_indices,
|
|
346
|
+
triu_indices_from as triu_indices_from,
|
|
347
|
+
vander as vander,
|
|
348
|
+
)
|
|
349
|
+
from numpy.lib._type_check_impl import (
|
|
350
|
+
common_type as common_type,
|
|
351
|
+
imag as imag,
|
|
352
|
+
iscomplex as iscomplex,
|
|
353
|
+
iscomplexobj as iscomplexobj,
|
|
354
|
+
isreal as isreal,
|
|
355
|
+
isrealobj as isrealobj,
|
|
356
|
+
mintypecode as mintypecode,
|
|
357
|
+
nan_to_num as nan_to_num,
|
|
358
|
+
real as real,
|
|
359
|
+
real_if_close as real_if_close,
|
|
360
|
+
typename as typename,
|
|
361
|
+
)
|
|
362
|
+
from numpy.lib._ufunclike_impl import (
|
|
363
|
+
fix as fix,
|
|
364
|
+
isneginf as isneginf,
|
|
365
|
+
isposinf as isposinf,
|
|
366
|
+
)
|
|
367
|
+
from numpy.lib._utils_impl import (
|
|
368
|
+
get_include as get_include,
|
|
369
|
+
info as info,
|
|
370
|
+
show_runtime as show_runtime,
|
|
371
|
+
)
|
|
372
|
+
from numpy.matrixlib import (
|
|
373
|
+
asmatrix as asmatrix,
|
|
374
|
+
bmat as bmat,
|
|
375
|
+
matrix as matrix,
|
|
376
|
+
)
|
|
377
|
+
from shape_extensions import (
|
|
378
|
+
broadcast as _broadcast_shape,
|
|
379
|
+
Elements,
|
|
380
|
+
Flag,
|
|
381
|
+
Index,
|
|
382
|
+
index_shape,
|
|
383
|
+
Int,
|
|
384
|
+
IntTuple,
|
|
385
|
+
IntTuples,
|
|
386
|
+
IntVar,
|
|
387
|
+
MapIntTuples,
|
|
388
|
+
RegularNestedList,
|
|
389
|
+
)
|
|
13
390
|
|
|
14
|
-
|
|
391
|
+
# Preserve NumPy's canonical re-exports before local shape-aware declarations.
|
|
392
|
+
from . import (
|
|
393
|
+
char as char,
|
|
394
|
+
core as core,
|
|
395
|
+
ctypeslib as ctypeslib,
|
|
396
|
+
dtypes as dtypes,
|
|
397
|
+
exceptions as exceptions,
|
|
398
|
+
f2py as f2py,
|
|
399
|
+
fft as fft,
|
|
400
|
+
lib as lib,
|
|
401
|
+
linalg as linalg,
|
|
402
|
+
ma as ma,
|
|
403
|
+
polynomial as polynomial,
|
|
404
|
+
random as random,
|
|
405
|
+
rec as rec,
|
|
406
|
+
strings as strings,
|
|
407
|
+
testing as testing,
|
|
408
|
+
typing as typing,
|
|
409
|
+
)
|
|
15
410
|
|
|
16
411
|
type _Shape = IntTuple
|
|
17
|
-
type _AnyShape = tuple[Any, ...]
|
|
18
412
|
type _Axis = int | tuple[int, ...] | None
|
|
19
413
|
type _BasicIndex = int | slice | list[int] | None | EllipsisType
|
|
20
414
|
|
|
@@ -28,6 +422,26 @@ class intp(generic): ...
|
|
|
28
422
|
|
|
29
423
|
type _IndexScalar = int | bool_ | int32 | int64 | intp
|
|
30
424
|
type _IndexSequence = Sequence[_IndexScalar] | Sequence[Sequence[_IndexScalar]]
|
|
425
|
+
type _ArrayIndex = (
|
|
426
|
+
_BasicIndex
|
|
427
|
+
| _IndexScalar
|
|
428
|
+
| _IndexSequence
|
|
429
|
+
| ndarray
|
|
430
|
+
| tuple[_BasicIndex | _IndexScalar | _IndexSequence | ndarray, ...]
|
|
431
|
+
)
|
|
432
|
+
type _ArrayScalar = None | bool | int | float | complex | str | bytes | generic
|
|
433
|
+
|
|
434
|
+
__version__: Final[str]
|
|
435
|
+
e: Final[float]
|
|
436
|
+
euler_gamma: Final[float]
|
|
437
|
+
pi: Final[float]
|
|
438
|
+
inf: Final[float]
|
|
439
|
+
nan: Final[float]
|
|
440
|
+
little_endian: Final[py_bool]
|
|
441
|
+
False_: Final[bool_]
|
|
442
|
+
True_: Final[bool_]
|
|
443
|
+
newaxis: Final[None] = None
|
|
444
|
+
test: Final[PytestTester]
|
|
31
445
|
|
|
32
446
|
class dtype[Scalar = Any]:
|
|
33
447
|
@overload
|
|
@@ -40,10 +454,42 @@ class dtype[Scalar = Any]:
|
|
|
40
454
|
# its body. Annotations inside the class reach the class through this alias.
|
|
41
455
|
_dtype = dtype
|
|
42
456
|
|
|
43
|
-
|
|
44
|
-
|
|
457
|
+
class _Flags:
|
|
458
|
+
f_contiguous: py_bool
|
|
459
|
+
|
|
460
|
+
class ndarray[Shape: _Shape = _Shape, DType = Any]:
|
|
45
461
|
shape: Shape
|
|
46
462
|
dtype: DType
|
|
463
|
+
flags: _Flags
|
|
464
|
+
strides: tuple[int, ...]
|
|
465
|
+
@property
|
|
466
|
+
def __array_interface__(self) -> Any: ...
|
|
467
|
+
def __array__(
|
|
468
|
+
self, dtype: Any = None, copy: py_bool | None = None
|
|
469
|
+
) -> ndarray[Shape]: ...
|
|
470
|
+
def __buffer__(self, flags: int, /) -> memoryview: ...
|
|
471
|
+
@property
|
|
472
|
+
def base(self) -> Any: ...
|
|
473
|
+
@property
|
|
474
|
+
def data(self) -> memoryview: ...
|
|
475
|
+
@property
|
|
476
|
+
def device(self) -> Literal["cpu"]: ...
|
|
477
|
+
@property
|
|
478
|
+
def itemsize(self) -> int: ...
|
|
479
|
+
@property
|
|
480
|
+
def nbytes(self) -> int: ...
|
|
481
|
+
@property
|
|
482
|
+
def ndim(self) -> int: ...
|
|
483
|
+
@property
|
|
484
|
+
def size(self) -> int: ...
|
|
485
|
+
@property
|
|
486
|
+
def imag(self) -> ndarray[Shape]: ...
|
|
487
|
+
@imag.setter
|
|
488
|
+
def imag(self, value: Any) -> None: ...
|
|
489
|
+
@property
|
|
490
|
+
def real(self) -> ndarray[Shape]: ...
|
|
491
|
+
@real.setter
|
|
492
|
+
def real(self, value: Any) -> None: ...
|
|
47
493
|
@overload
|
|
48
494
|
def __len__[N: IntVar](self: ndarray[[N]]) -> Int[N]: ...
|
|
49
495
|
@overload
|
|
@@ -71,163 +517,841 @@ class ndarray[Shape: _Shape = _AnyShape, DType = Any]:
|
|
|
71
517
|
@overload
|
|
72
518
|
def __getitem__(
|
|
73
519
|
self: ndarray[Shape, DType],
|
|
74
|
-
key:
|
|
75
|
-
| _IndexScalar
|
|
76
|
-
| _IndexSequence
|
|
77
|
-
| ndarray
|
|
78
|
-
| tuple[_BasicIndex | _IndexScalar | _IndexSequence | ndarray, ...],
|
|
520
|
+
key: _ArrayIndex,
|
|
79
521
|
) -> ndarray[IntTuple, DType]: ...
|
|
522
|
+
# Assignment preserves the receiver's shape; value broadcasting is gradual.
|
|
523
|
+
def __setitem__(self, key: _ArrayIndex, value: ArrayLike, /) -> None: ...
|
|
524
|
+
@overload
|
|
525
|
+
def __iter__[N: IntVar, M: IntVar](
|
|
526
|
+
self: ndarray[[N, M], DType], /
|
|
527
|
+
) -> Iterator[ndarray[[M], DType]]: ...
|
|
528
|
+
# Scalar dtypes and iteration over other ranks remain gradual.
|
|
529
|
+
@overload
|
|
530
|
+
def __iter__(self, /) -> Iterator[Any]: ...
|
|
531
|
+
def __int__(self: ndarray[[]], /) -> int: ...
|
|
532
|
+
def __float__(self: ndarray[[]], /) -> float: ...
|
|
533
|
+
def __complex__(self: ndarray[[]], /) -> complex: ...
|
|
80
534
|
# Only 2-D transpose is modeled for the NumPy shape-stub MVP.
|
|
81
535
|
@property
|
|
82
536
|
def T[N: IntVar, P: IntVar](
|
|
83
537
|
self: ndarray[[N, P], DType],
|
|
84
538
|
) -> ndarray[[P, N], DType]: ...
|
|
539
|
+
# Unpacking preserves gradual array shapes instead of using the scalar default.
|
|
540
|
+
def __add__[OtherShape: _Shape = []](
|
|
541
|
+
self, other: ndarray[[*Elements[OtherShape]]] | int | float
|
|
542
|
+
) -> ndarray[_broadcast_shape(Shape, OtherShape), DType]: ...
|
|
543
|
+
def __radd__[OtherShape: _Shape = []](
|
|
544
|
+
self, other: ndarray[[*Elements[OtherShape]]] | int | float
|
|
545
|
+
) -> ndarray[_broadcast_shape(Shape, OtherShape), DType]: ...
|
|
546
|
+
def __sub__[OtherShape: _Shape = []](
|
|
547
|
+
self, other: ndarray[[*Elements[OtherShape]]] | int | float
|
|
548
|
+
) -> ndarray[_broadcast_shape(Shape, OtherShape), DType]: ...
|
|
549
|
+
def __rsub__[OtherShape: _Shape = []](
|
|
550
|
+
self, other: ndarray[[*Elements[OtherShape]]] | int | float
|
|
551
|
+
) -> ndarray[_broadcast_shape(Shape, OtherShape), DType]: ...
|
|
552
|
+
def __truediv__[OtherShape: _Shape = []](
|
|
553
|
+
self, other: ndarray[[*Elements[OtherShape]]] | int | float
|
|
554
|
+
) -> ndarray[_broadcast_shape(Shape, OtherShape), DType]: ...
|
|
555
|
+
def __rtruediv__[OtherShape: _Shape = []](
|
|
556
|
+
self, other: ndarray[[*Elements[OtherShape]]] | int | float
|
|
557
|
+
) -> ndarray[_broadcast_shape(Shape, OtherShape), DType]: ...
|
|
558
|
+
def __mul__[OtherShape: _Shape = []](
|
|
559
|
+
self, other: ndarray[[*Elements[OtherShape]]] | int | float
|
|
560
|
+
) -> ndarray[_broadcast_shape(Shape, OtherShape), DType]: ...
|
|
561
|
+
def __rmul__[OtherShape: _Shape = []](
|
|
562
|
+
self, other: ndarray[[*Elements[OtherShape]]] | int | float
|
|
563
|
+
) -> ndarray[_broadcast_shape(Shape, OtherShape), DType]: ...
|
|
564
|
+
def __floordiv__[OtherShape: _Shape = []](
|
|
565
|
+
self, other: ndarray[[*Elements[OtherShape]]] | int | float
|
|
566
|
+
) -> ndarray[_broadcast_shape(Shape, OtherShape), DType]: ...
|
|
567
|
+
def __rfloordiv__[OtherShape: _Shape = []](
|
|
568
|
+
self, other: ndarray[[*Elements[OtherShape]]] | int | float
|
|
569
|
+
) -> ndarray[_broadcast_shape(Shape, OtherShape), DType]: ...
|
|
570
|
+
def __mod__[OtherShape: _Shape = []](
|
|
571
|
+
self, other: ndarray[[*Elements[OtherShape]]] | int | float
|
|
572
|
+
) -> ndarray[_broadcast_shape(Shape, OtherShape), DType]: ...
|
|
573
|
+
def __rmod__[OtherShape: _Shape = []](
|
|
574
|
+
self, other: ndarray[[*Elements[OtherShape]]] | int | float
|
|
575
|
+
) -> ndarray[_broadcast_shape(Shape, OtherShape), DType]: ...
|
|
576
|
+
def __neg__(self) -> ndarray[Shape, DType]: ...
|
|
577
|
+
def __pos__(self) -> ndarray[Shape, DType]: ...
|
|
578
|
+
def __pow__[OtherShape: _Shape = []](
|
|
579
|
+
self, other: ndarray[[*Elements[OtherShape]]] | int | float
|
|
580
|
+
) -> ndarray[_broadcast_shape(Shape, OtherShape), DType]: ...
|
|
581
|
+
def __rpow__[OtherShape: _Shape = []](
|
|
582
|
+
self, other: ndarray[[*Elements[OtherShape]]] | int | float
|
|
583
|
+
) -> ndarray[_broadcast_shape(Shape, OtherShape), DType]: ...
|
|
584
|
+
# Scalar results also satisfy Python's truth-valued comparison protocols.
|
|
85
585
|
@overload
|
|
86
|
-
def
|
|
87
|
-
@overload
|
|
88
|
-
def __add__[OtherShape: _Shape](
|
|
89
|
-
self, other: ndarray[OtherShape]
|
|
90
|
-
) -> ndarray[broadcast(Shape, OtherShape), DType]: ...
|
|
91
|
-
@overload
|
|
92
|
-
def __radd__(self, other: int | float) -> ndarray[Shape, DType]: ...
|
|
93
|
-
@overload
|
|
94
|
-
def __radd__[OtherShape: _Shape](
|
|
95
|
-
self, other: ndarray[OtherShape]
|
|
96
|
-
) -> ndarray[broadcast(Shape, OtherShape), DType]: ...
|
|
97
|
-
@overload
|
|
98
|
-
def __sub__(self, other: int | float) -> ndarray[Shape, DType]: ...
|
|
99
|
-
@overload
|
|
100
|
-
def __sub__[OtherShape: _Shape](
|
|
101
|
-
self, other: ndarray[OtherShape]
|
|
102
|
-
) -> ndarray[broadcast(Shape, OtherShape), DType]: ...
|
|
103
|
-
@overload
|
|
104
|
-
def __rsub__(self, other: int | float) -> ndarray[Shape, DType]: ...
|
|
105
|
-
@overload
|
|
106
|
-
def __rsub__[OtherShape: _Shape](
|
|
107
|
-
self, other: ndarray[OtherShape]
|
|
108
|
-
) -> ndarray[broadcast(Shape, OtherShape), DType]: ...
|
|
109
|
-
@overload
|
|
110
|
-
def __truediv__(self, other: int | float) -> ndarray[Shape, DType]: ...
|
|
111
|
-
@overload
|
|
112
|
-
def __truediv__[OtherShape: _Shape](
|
|
113
|
-
self, other: ndarray[OtherShape]
|
|
114
|
-
) -> ndarray[broadcast(Shape, OtherShape), DType]: ...
|
|
115
|
-
@overload
|
|
116
|
-
def __rtruediv__(self, other: int | float) -> ndarray[Shape, DType]: ...
|
|
586
|
+
def __lt__(self: ndarray[[]], other: Any, /) -> Any: ...
|
|
117
587
|
@overload
|
|
118
|
-
def
|
|
119
|
-
self,
|
|
120
|
-
|
|
588
|
+
def __lt__[OtherShape: _Shape = []](
|
|
589
|
+
self,
|
|
590
|
+
other: ndarray[[*Elements[OtherShape]]]
|
|
591
|
+
| int
|
|
592
|
+
| float
|
|
593
|
+
| complex
|
|
594
|
+
| str
|
|
595
|
+
| bytes
|
|
596
|
+
| generic,
|
|
597
|
+
/,
|
|
598
|
+
) -> ndarray[_broadcast_shape(Shape, OtherShape), _dtype[bool_]]: ...
|
|
121
599
|
@overload
|
|
122
|
-
def
|
|
600
|
+
def __lt__(self, other: ArrayLike, /) -> ndarray[IntTuple, _dtype[bool_]]: ...
|
|
123
601
|
@overload
|
|
124
|
-
def
|
|
125
|
-
self, other: ndarray[OtherShape]
|
|
126
|
-
) -> ndarray[broadcast(Shape, OtherShape), DType]: ...
|
|
602
|
+
def __le__(self: ndarray[[]], other: Any, /) -> Any: ...
|
|
127
603
|
@overload
|
|
128
|
-
def
|
|
604
|
+
def __le__[OtherShape: _Shape = []](
|
|
605
|
+
self,
|
|
606
|
+
other: ndarray[[*Elements[OtherShape]]]
|
|
607
|
+
| int
|
|
608
|
+
| float
|
|
609
|
+
| complex
|
|
610
|
+
| str
|
|
611
|
+
| bytes
|
|
612
|
+
| generic,
|
|
613
|
+
/,
|
|
614
|
+
) -> ndarray[_broadcast_shape(Shape, OtherShape), _dtype[bool_]]: ...
|
|
129
615
|
@overload
|
|
130
|
-
def
|
|
131
|
-
self, other: ndarray[OtherShape]
|
|
132
|
-
) -> ndarray[broadcast(Shape, OtherShape), DType]: ...
|
|
616
|
+
def __le__(self, other: ArrayLike, /) -> ndarray[IntTuple, _dtype[bool_]]: ...
|
|
133
617
|
@overload
|
|
134
|
-
def
|
|
618
|
+
def __gt__(self: ndarray[[]], other: Any, /) -> Any: ...
|
|
135
619
|
@overload
|
|
136
|
-
def
|
|
137
|
-
self,
|
|
138
|
-
|
|
620
|
+
def __gt__[OtherShape: _Shape = []](
|
|
621
|
+
self,
|
|
622
|
+
other: ndarray[[*Elements[OtherShape]]]
|
|
623
|
+
| int
|
|
624
|
+
| float
|
|
625
|
+
| complex
|
|
626
|
+
| str
|
|
627
|
+
| bytes
|
|
628
|
+
| generic,
|
|
629
|
+
/,
|
|
630
|
+
) -> ndarray[_broadcast_shape(Shape, OtherShape), _dtype[bool_]]: ...
|
|
139
631
|
@overload
|
|
140
|
-
def
|
|
632
|
+
def __gt__(self, other: ArrayLike, /) -> ndarray[IntTuple, _dtype[bool_]]: ...
|
|
141
633
|
@overload
|
|
142
|
-
def
|
|
143
|
-
self, other: ndarray[OtherShape]
|
|
144
|
-
) -> ndarray[broadcast(Shape, OtherShape), DType]: ...
|
|
634
|
+
def __ge__(self: ndarray[[]], other: Any, /) -> Any: ...
|
|
145
635
|
@overload
|
|
146
|
-
def
|
|
636
|
+
def __ge__[OtherShape: _Shape = []](
|
|
637
|
+
self,
|
|
638
|
+
other: ndarray[[*Elements[OtherShape]]]
|
|
639
|
+
| int
|
|
640
|
+
| float
|
|
641
|
+
| complex
|
|
642
|
+
| str
|
|
643
|
+
| bytes
|
|
644
|
+
| generic,
|
|
645
|
+
/,
|
|
646
|
+
) -> ndarray[_broadcast_shape(Shape, OtherShape), _dtype[bool_]]: ...
|
|
147
647
|
@overload
|
|
148
|
-
def
|
|
149
|
-
self, other: ndarray[OtherShape]
|
|
150
|
-
) -> ndarray[broadcast(Shape, OtherShape), DType]: ...
|
|
648
|
+
def __ge__(self, other: ArrayLike, /) -> ndarray[IntTuple, _dtype[bool_]]: ...
|
|
151
649
|
@overload
|
|
152
|
-
def
|
|
650
|
+
def __eq__(self: ndarray[[]], other: Any, /) -> Any: ... # type: ignore[bad-override]
|
|
153
651
|
@overload
|
|
154
|
-
def
|
|
155
|
-
self,
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
652
|
+
def __eq__[OtherShape: _Shape = []](
|
|
653
|
+
self,
|
|
654
|
+
other: ndarray[[*Elements[OtherShape]]]
|
|
655
|
+
| int
|
|
656
|
+
| float
|
|
657
|
+
| complex
|
|
658
|
+
| str
|
|
659
|
+
| bytes
|
|
660
|
+
| generic,
|
|
661
|
+
/,
|
|
662
|
+
) -> ndarray[_broadcast_shape(Shape, OtherShape), _dtype[bool_]]: ...
|
|
159
663
|
@overload
|
|
160
|
-
def
|
|
664
|
+
def __eq__(self, other: ArrayLike, /) -> ndarray[IntTuple, _dtype[bool_]]: ...
|
|
161
665
|
@overload
|
|
162
|
-
def
|
|
163
|
-
self, other: ndarray[OtherShape]
|
|
164
|
-
) -> ndarray[broadcast(Shape, OtherShape), DType]: ...
|
|
666
|
+
def __ne__(self: ndarray[[]], other: Any, /) -> Any: ... # type: ignore[bad-override]
|
|
165
667
|
@overload
|
|
166
|
-
def
|
|
668
|
+
def __ne__[OtherShape: _Shape = []](
|
|
669
|
+
self,
|
|
670
|
+
other: ndarray[[*Elements[OtherShape]]]
|
|
671
|
+
| int
|
|
672
|
+
| float
|
|
673
|
+
| complex
|
|
674
|
+
| str
|
|
675
|
+
| bytes
|
|
676
|
+
| generic,
|
|
677
|
+
/,
|
|
678
|
+
) -> ndarray[_broadcast_shape(Shape, OtherShape), _dtype[bool_]]: ...
|
|
167
679
|
@overload
|
|
168
|
-
def
|
|
169
|
-
|
|
170
|
-
|
|
680
|
+
def __ne__(self, other: ArrayLike, /) -> ndarray[IntTuple, _dtype[bool_]]: ...
|
|
681
|
+
def __invert__(self) -> ndarray[Shape, DType]: ...
|
|
682
|
+
def __and__[OtherShape: _Shape = []](
|
|
683
|
+
self, other: ndarray[[*Elements[OtherShape]]] | _IndexScalar, /
|
|
684
|
+
) -> ndarray[_broadcast_shape(Shape, OtherShape)]: ...
|
|
685
|
+
def __or__[OtherShape: _Shape = []](
|
|
686
|
+
self, other: ndarray[[*Elements[OtherShape]]] | _IndexScalar, /
|
|
687
|
+
) -> ndarray[_broadcast_shape(Shape, OtherShape)]: ...
|
|
688
|
+
def __xor__[OtherShape: _Shape = []](
|
|
689
|
+
self, other: ndarray[[*Elements[OtherShape]]] | _IndexScalar, /
|
|
690
|
+
) -> ndarray[_broadcast_shape(Shape, OtherShape)]: ...
|
|
691
|
+
def __rand__[OtherShape: _Shape = []](
|
|
692
|
+
self, other: ndarray[[*Elements[OtherShape]]] | _IndexScalar, /
|
|
693
|
+
) -> ndarray[_broadcast_shape(Shape, OtherShape)]: ...
|
|
694
|
+
def __ror__[OtherShape: _Shape = []](
|
|
695
|
+
self, other: ndarray[[*Elements[OtherShape]]] | _IndexScalar, /
|
|
696
|
+
) -> ndarray[_broadcast_shape(Shape, OtherShape)]: ...
|
|
697
|
+
def __rxor__[OtherShape: _Shape = []](
|
|
698
|
+
self, other: ndarray[[*Elements[OtherShape]]] | _IndexScalar, /
|
|
699
|
+
) -> ndarray[_broadcast_shape(Shape, OtherShape)]: ...
|
|
171
700
|
def __matmul__[OtherShape: _Shape](
|
|
172
701
|
self, other: ndarray[OtherShape]
|
|
173
702
|
) -> ndarray[matmul_shape(Shape, OtherShape), DType]: ...
|
|
174
|
-
def mean[Axis: Flag[_Axis], KeepDims: Flag[
|
|
703
|
+
def mean[Axis: Flag[_Axis], KeepDims: Flag[py_bool]](
|
|
175
704
|
self,
|
|
176
705
|
axis: Axis = None,
|
|
177
706
|
*,
|
|
178
707
|
keepdims: KeepDims = False,
|
|
179
708
|
) -> ndarray[reduce_shape(Shape, Axis, KeepDims), DType]: ...
|
|
180
|
-
def sum[Axis: Flag[_Axis], KeepDims: Flag[
|
|
709
|
+
def sum[Axis: Flag[_Axis], KeepDims: Flag[py_bool]](
|
|
181
710
|
self,
|
|
182
711
|
axis: Axis = None,
|
|
183
712
|
*,
|
|
184
713
|
keepdims: KeepDims = False,
|
|
185
714
|
) -> ndarray[reduce_shape(Shape, Axis, KeepDims), DType]: ...
|
|
186
|
-
def min[Axis: Flag[_Axis], KeepDims: Flag[
|
|
715
|
+
def min[Axis: Flag[_Axis], KeepDims: Flag[py_bool]](
|
|
187
716
|
self,
|
|
188
717
|
axis: Axis = None,
|
|
189
718
|
*,
|
|
190
719
|
keepdims: KeepDims = False,
|
|
191
720
|
) -> ndarray[reduce_shape(Shape, Axis, KeepDims), DType]: ...
|
|
192
|
-
def max[Axis: Flag[_Axis], KeepDims: Flag[
|
|
721
|
+
def max[Axis: Flag[_Axis], KeepDims: Flag[py_bool]](
|
|
193
722
|
self,
|
|
194
723
|
axis: Axis = None,
|
|
195
724
|
*,
|
|
196
725
|
keepdims: KeepDims = False,
|
|
197
726
|
) -> ndarray[reduce_shape(Shape, Axis, KeepDims), DType]: ...
|
|
727
|
+
def all[Axis: Flag[_Axis], KeepDims: Flag[py_bool]](
|
|
728
|
+
self,
|
|
729
|
+
axis: Axis = None,
|
|
730
|
+
out: Any = None,
|
|
731
|
+
keepdims: KeepDims = False,
|
|
732
|
+
*,
|
|
733
|
+
where: Any = True,
|
|
734
|
+
) -> ndarray[reduce_shape(Shape, Axis, KeepDims), _dtype[bool_]]: ...
|
|
735
|
+
def any[Axis: Flag[_Axis], KeepDims: Flag[py_bool]](
|
|
736
|
+
self,
|
|
737
|
+
axis: Axis = None,
|
|
738
|
+
out: Any = None,
|
|
739
|
+
keepdims: KeepDims = False,
|
|
740
|
+
*,
|
|
741
|
+
where: Any = True,
|
|
742
|
+
) -> ndarray[reduce_shape(Shape, Axis, KeepDims), _dtype[bool_]]: ...
|
|
743
|
+
def argmax[Axis: Flag[_Axis], KeepDims: Flag[py_bool]](
|
|
744
|
+
self,
|
|
745
|
+
axis: Axis = None,
|
|
746
|
+
out: Any = None,
|
|
747
|
+
*,
|
|
748
|
+
keepdims: KeepDims = False,
|
|
749
|
+
) -> ndarray[reduce_shape(Shape, Axis, KeepDims), _dtype[intp]]: ...
|
|
750
|
+
def argmin[Axis: Flag[_Axis], KeepDims: Flag[py_bool]](
|
|
751
|
+
self,
|
|
752
|
+
axis: Axis = None,
|
|
753
|
+
out: Any = None,
|
|
754
|
+
*,
|
|
755
|
+
keepdims: KeepDims = False,
|
|
756
|
+
) -> ndarray[reduce_shape(Shape, Axis, KeepDims), _dtype[intp]]: ...
|
|
757
|
+
def prod[Axis: Flag[_Axis], KeepDims: Flag[py_bool]](
|
|
758
|
+
self,
|
|
759
|
+
axis: Axis = None,
|
|
760
|
+
dtype: Any = None,
|
|
761
|
+
out: Any = None,
|
|
762
|
+
*,
|
|
763
|
+
keepdims: KeepDims = False,
|
|
764
|
+
initial: Any = None,
|
|
765
|
+
where: Any = True,
|
|
766
|
+
) -> ndarray[reduce_shape(Shape, Axis, KeepDims)]: ...
|
|
767
|
+
def std[Axis: Flag[_Axis], KeepDims: Flag[py_bool]](
|
|
768
|
+
self,
|
|
769
|
+
axis: Axis = None,
|
|
770
|
+
dtype: Any = None,
|
|
771
|
+
out: Any = None,
|
|
772
|
+
ddof: float = 0,
|
|
773
|
+
*,
|
|
774
|
+
keepdims: KeepDims = False,
|
|
775
|
+
where: Any = True,
|
|
776
|
+
mean: Any = None,
|
|
777
|
+
correction: Any = None,
|
|
778
|
+
) -> ndarray[reduce_shape(Shape, Axis, KeepDims)]: ...
|
|
779
|
+
def var[Axis: Flag[_Axis], KeepDims: Flag[py_bool]](
|
|
780
|
+
self,
|
|
781
|
+
axis: Axis = None,
|
|
782
|
+
dtype: Any = None,
|
|
783
|
+
out: Any = None,
|
|
784
|
+
ddof: float = 0,
|
|
785
|
+
*,
|
|
786
|
+
keepdims: KeepDims = False,
|
|
787
|
+
where: Any = True,
|
|
788
|
+
mean: Any = None,
|
|
789
|
+
correction: Any = None,
|
|
790
|
+
) -> ndarray[reduce_shape(Shape, Axis, KeepDims)]: ...
|
|
791
|
+
@overload
|
|
792
|
+
def argpartition(
|
|
793
|
+
self,
|
|
794
|
+
kth: Any,
|
|
795
|
+
axis: None,
|
|
796
|
+
kind: str = "introselect",
|
|
797
|
+
order: Any = None,
|
|
798
|
+
) -> ndarray[[int], _dtype[intp]]: ...
|
|
799
|
+
@overload
|
|
800
|
+
def argpartition(
|
|
801
|
+
self,
|
|
802
|
+
kth: Any,
|
|
803
|
+
axis: int = -1,
|
|
804
|
+
kind: str = "introselect",
|
|
805
|
+
order: Any = None,
|
|
806
|
+
) -> ndarray[Shape, _dtype[intp]]: ...
|
|
807
|
+
@overload
|
|
808
|
+
def argsort(
|
|
809
|
+
self,
|
|
810
|
+
axis: None,
|
|
811
|
+
kind: str | None = None,
|
|
812
|
+
order: Any = None,
|
|
813
|
+
*,
|
|
814
|
+
stable: py_bool | None = None,
|
|
815
|
+
descending: py_bool | None = None,
|
|
816
|
+
) -> ndarray[[int], _dtype[intp]]: ...
|
|
817
|
+
@overload
|
|
818
|
+
def argsort(
|
|
819
|
+
self,
|
|
820
|
+
axis: int = -1,
|
|
821
|
+
kind: str | None = None,
|
|
822
|
+
order: Any = None,
|
|
823
|
+
*,
|
|
824
|
+
stable: py_bool | None = None,
|
|
825
|
+
descending: py_bool | None = None,
|
|
826
|
+
) -> ndarray[Shape, _dtype[intp]]: ...
|
|
827
|
+
@overload
|
|
828
|
+
def astype[ScalarT: generic](
|
|
829
|
+
self,
|
|
830
|
+
dtype: type[ScalarT] | _dtype[ScalarT],
|
|
831
|
+
order: str = "K",
|
|
832
|
+
casting: str = "unsafe",
|
|
833
|
+
subok: py_bool = True,
|
|
834
|
+
copy: py_bool = True,
|
|
835
|
+
) -> ndarray[Shape, _dtype[ScalarT]]: ...
|
|
836
|
+
@overload
|
|
837
|
+
def astype(
|
|
838
|
+
self,
|
|
839
|
+
dtype: Any,
|
|
840
|
+
order: str = "K",
|
|
841
|
+
casting: str = "unsafe",
|
|
842
|
+
subok: py_bool = True,
|
|
843
|
+
copy: py_bool = True,
|
|
844
|
+
) -> ndarray[Shape]: ...
|
|
845
|
+
def byteswap(self, inplace: py_bool = False) -> ndarray[Shape, DType]: ...
|
|
846
|
+
def clip(
|
|
847
|
+
self, min: Any = None, max: Any = None, out: Any = None, **kwargs: Any
|
|
848
|
+
) -> ndarray[Shape, DType]: ...
|
|
849
|
+
def conj(self) -> ndarray[Shape, DType]: ...
|
|
850
|
+
def conjugate(self) -> ndarray[Shape, DType]: ...
|
|
851
|
+
def copy(self, order: str = "C") -> ndarray[Shape, DType]: ...
|
|
852
|
+
@overload
|
|
853
|
+
def cumprod(
|
|
854
|
+
self, axis: None = None, dtype: Any = None, out: Any = None
|
|
855
|
+
) -> ndarray[[int]]: ...
|
|
856
|
+
@overload
|
|
857
|
+
def cumprod(
|
|
858
|
+
self, axis: int, dtype: Any = None, out: Any = None
|
|
859
|
+
) -> ndarray[Shape]: ...
|
|
860
|
+
@overload
|
|
861
|
+
def cumsum(
|
|
862
|
+
self, axis: None = None, dtype: Any = None, out: Any = None
|
|
863
|
+
) -> ndarray[[int]]: ...
|
|
864
|
+
@overload
|
|
865
|
+
def cumsum(
|
|
866
|
+
self, axis: int, dtype: Any = None, out: Any = None
|
|
867
|
+
) -> ndarray[Shape]: ...
|
|
868
|
+
def dump(self, file: Any) -> None: ...
|
|
869
|
+
def dumps(self) -> bytes: ...
|
|
870
|
+
def fill(self, value: Any, /) -> None: ...
|
|
871
|
+
def flatten(self, order: str = "C") -> ndarray[[int], DType]: ...
|
|
872
|
+
def getfield(self, dtype: Any, offset: int = 0) -> ndarray[Shape]: ...
|
|
873
|
+
def item(self, *args: Any) -> Any: ...
|
|
874
|
+
def partition(
|
|
875
|
+
self,
|
|
876
|
+
kth: Any,
|
|
877
|
+
axis: int = -1,
|
|
878
|
+
kind: str = "introselect",
|
|
879
|
+
order: Any = None,
|
|
880
|
+
) -> None: ...
|
|
881
|
+
def put(self, indices: Any, values: Any, mode: str = "raise") -> None: ...
|
|
882
|
+
def ravel(self, order: str = "C") -> ndarray[[int], DType]: ...
|
|
883
|
+
# TODO(stroxler): Model receiver invalidation for shape-changing mutation.
|
|
884
|
+
resize: Any
|
|
885
|
+
def round(self, decimals: int = 0, out: Any = None) -> ndarray[Shape, DType]: ...
|
|
886
|
+
def setfield(self, val: Any, dtype: Any, offset: int = 0) -> None: ...
|
|
887
|
+
def setflags(
|
|
888
|
+
self,
|
|
889
|
+
write: py_bool | None = None,
|
|
890
|
+
align: py_bool | None = None,
|
|
891
|
+
uic: py_bool | None = None,
|
|
892
|
+
) -> None: ...
|
|
893
|
+
def sort(
|
|
894
|
+
self,
|
|
895
|
+
axis: int = -1,
|
|
896
|
+
kind: str | None = None,
|
|
897
|
+
order: Any = None,
|
|
898
|
+
*,
|
|
899
|
+
stable: py_bool | None = None,
|
|
900
|
+
) -> None: ...
|
|
901
|
+
def to_device(
|
|
902
|
+
self, device: Literal["cpu"], /, *, stream: Any = None
|
|
903
|
+
) -> ndarray[Shape, DType]: ...
|
|
904
|
+
def tobytes(self, order: str = "C") -> bytes: ...
|
|
905
|
+
def tofile(self, fid: Any, sep: str = "", format: str = "%s") -> None: ...
|
|
906
|
+
def tolist(self) -> Any: ...
|
|
907
|
+
|
|
908
|
+
# TODO(stroxler): Replace these placeholders with shape-aware declarations.
|
|
909
|
+
choose: Any
|
|
910
|
+
compress: Any
|
|
911
|
+
ctypes: Any
|
|
912
|
+
diagonal: Any
|
|
913
|
+
dot: Any
|
|
914
|
+
flat: Any
|
|
915
|
+
mT: Any
|
|
916
|
+
nonzero: Any
|
|
917
|
+
repeat: Any
|
|
918
|
+
reshape: Any
|
|
919
|
+
searchsorted: Any
|
|
920
|
+
squeeze: Any
|
|
921
|
+
swapaxes: Any
|
|
922
|
+
take: Any
|
|
923
|
+
trace: Any
|
|
924
|
+
transpose: Any
|
|
925
|
+
view: Any
|
|
926
|
+
|
|
927
|
+
class ufunc:
|
|
928
|
+
__name__: str
|
|
929
|
+
nin: int
|
|
930
|
+
nout: int
|
|
931
|
+
nargs: int
|
|
932
|
+
ntypes: int
|
|
933
|
+
types: list[str]
|
|
934
|
+
identity: Any
|
|
935
|
+
signature: str | None
|
|
936
|
+
def __call__(self, /, *args: Any, **kwargs: Any) -> Any: ...
|
|
937
|
+
def accumulate(self, array: Any, /, *args: Any, **kwargs: Any) -> Any: ...
|
|
938
|
+
def reduce(self, array: Any, /, *args: Any, **kwargs: Any) -> Any: ...
|
|
939
|
+
def reduceat(
|
|
940
|
+
self, array: Any, indices: Any, /, *args: Any, **kwargs: Any
|
|
941
|
+
) -> Any: ...
|
|
942
|
+
def outer(self, a: Any, b: Any, /, **kwargs: Any) -> Any: ...
|
|
943
|
+
def at(self, a: ndarray, indices: Any, b: Any = None, /) -> None: ...
|
|
944
|
+
|
|
945
|
+
permute_dims = transpose
|
|
946
|
+
# TODO(stroxler): Make this precise when `concatenate` accepts overlay ndarrays.
|
|
947
|
+
concat: Any = concatenate
|
|
948
|
+
|
|
949
|
+
@overload
|
|
950
|
+
def stack[Shapes: IntTuples, Axis: Flag[int]](
|
|
951
|
+
arrays: MapIntTuples[lambda S: ndarray[S], Shapes], axis: Axis = 0
|
|
952
|
+
) -> ndarray[stack_shape(Shapes, Axis), Any]: ...
|
|
953
|
+
@overload
|
|
954
|
+
def stack(
|
|
955
|
+
arrays: Sequence[ArrayLike],
|
|
956
|
+
axis: SupportsIndex = 0,
|
|
957
|
+
out: None = None,
|
|
958
|
+
*,
|
|
959
|
+
dtype: Any = None,
|
|
960
|
+
casting: str = "same_kind",
|
|
961
|
+
) -> ndarray: ...
|
|
962
|
+
@overload
|
|
963
|
+
def stack[Out: ndarray](
|
|
964
|
+
arrays: Sequence[ArrayLike],
|
|
965
|
+
axis: SupportsIndex,
|
|
966
|
+
out: Out,
|
|
967
|
+
*,
|
|
968
|
+
dtype: Any = None,
|
|
969
|
+
casting: str = "same_kind",
|
|
970
|
+
) -> Out: ...
|
|
971
|
+
@overload
|
|
972
|
+
def stack[Out: ndarray](
|
|
973
|
+
arrays: Sequence[ArrayLike],
|
|
974
|
+
axis: SupportsIndex = 0,
|
|
975
|
+
*,
|
|
976
|
+
out: Out,
|
|
977
|
+
dtype: Any = None,
|
|
978
|
+
casting: str = "same_kind",
|
|
979
|
+
) -> Out: ...
|
|
980
|
+
|
|
981
|
+
# The output shape depends on the external object's DLPack representation.
|
|
982
|
+
def from_dlpack(
|
|
983
|
+
x: Any,
|
|
984
|
+
/,
|
|
985
|
+
*,
|
|
986
|
+
device: Literal["cpu"] | None = None,
|
|
987
|
+
copy: py_bool | None = None,
|
|
988
|
+
) -> ndarray: ...
|
|
989
|
+
|
|
990
|
+
class _UnaryUFunc(ufunc):
|
|
991
|
+
@overload
|
|
992
|
+
def __call__[Shape: _Shape](
|
|
993
|
+
self, x: ndarray[Shape], /, out: Any = None, **kwargs: Any
|
|
994
|
+
) -> ndarray[Shape]: ...
|
|
995
|
+
@overload
|
|
996
|
+
def __call__(self, x: Any, /, out: Any = None, **kwargs: Any) -> Any: ...
|
|
997
|
+
|
|
998
|
+
class _BinaryUFunc(ufunc):
|
|
999
|
+
@overload
|
|
1000
|
+
def __call__[Shape1: _Shape, Shape2: _Shape](
|
|
1001
|
+
self,
|
|
1002
|
+
x1: ndarray[Shape1],
|
|
1003
|
+
x2: ndarray[Shape2],
|
|
1004
|
+
/,
|
|
1005
|
+
out: Any = None,
|
|
1006
|
+
**kwargs: Any,
|
|
1007
|
+
) -> ndarray[_broadcast_shape(Shape1, Shape2)]: ...
|
|
1008
|
+
@overload
|
|
1009
|
+
def __call__[Shape: _Shape](
|
|
1010
|
+
self, x1: ndarray[Shape], x2: Any, /, out: Any = None, **kwargs: Any
|
|
1011
|
+
) -> ndarray[Shape]: ...
|
|
1012
|
+
@overload
|
|
1013
|
+
def __call__[Shape: _Shape](
|
|
1014
|
+
self, x1: Any, x2: ndarray[Shape], /, out: Any = None, **kwargs: Any
|
|
1015
|
+
) -> ndarray[Shape]: ...
|
|
1016
|
+
@overload
|
|
1017
|
+
def __call__(self, x1: Any, x2: Any, /, out: Any = None, **kwargs: Any) -> Any: ...
|
|
1018
|
+
|
|
1019
|
+
# The result dtype stays gradual because dtype promotion is not modeled, while
|
|
1020
|
+
# `ndarray.__matmul__` carries the left operand's dtype.
|
|
1021
|
+
class _MatmulUFunc(ufunc):
|
|
1022
|
+
@overload
|
|
1023
|
+
def __call__[LeftShape: _Shape, RightShape: _Shape](
|
|
1024
|
+
self,
|
|
1025
|
+
a: ndarray[LeftShape],
|
|
1026
|
+
b: ndarray[RightShape],
|
|
1027
|
+
/,
|
|
1028
|
+
out: Any = None,
|
|
1029
|
+
**kwargs: Any,
|
|
1030
|
+
) -> ndarray[matmul_shape(LeftShape, RightShape), Any]: ...
|
|
1031
|
+
@overload
|
|
1032
|
+
def __call__(self, a: Any, b: Any, /, out: Any = None, **kwargs: Any) -> Any: ...
|
|
1033
|
+
|
|
1034
|
+
class _UnaryTwoOutputUFunc(ufunc):
|
|
1035
|
+
@overload
|
|
1036
|
+
def __call__[Shape: _Shape](
|
|
1037
|
+
self, x: ndarray[Shape], /, out: Any = None, *outputs: Any, **kwargs: Any
|
|
1038
|
+
) -> tuple[ndarray[Shape], ndarray[Shape]]: ...
|
|
1039
|
+
@overload
|
|
1040
|
+
def __call__(
|
|
1041
|
+
self, x: Any, /, out: Any = None, *outputs: Any, **kwargs: Any
|
|
1042
|
+
) -> tuple[Any, Any]: ...
|
|
1043
|
+
|
|
1044
|
+
class _BinaryTwoOutputUFunc(ufunc):
|
|
1045
|
+
@overload
|
|
1046
|
+
def __call__[Shape1: _Shape, Shape2: _Shape](
|
|
1047
|
+
self,
|
|
1048
|
+
x1: ndarray[Shape1],
|
|
1049
|
+
x2: ndarray[Shape2],
|
|
1050
|
+
/,
|
|
1051
|
+
out: Any = None,
|
|
1052
|
+
*outputs: Any,
|
|
1053
|
+
**kwargs: Any,
|
|
1054
|
+
) -> tuple[
|
|
1055
|
+
ndarray[_broadcast_shape(Shape1, Shape2)],
|
|
1056
|
+
ndarray[_broadcast_shape(Shape1, Shape2)],
|
|
1057
|
+
]: ...
|
|
1058
|
+
@overload
|
|
1059
|
+
def __call__[Shape: _Shape](
|
|
1060
|
+
self,
|
|
1061
|
+
x1: ndarray[Shape],
|
|
1062
|
+
x2: Any,
|
|
1063
|
+
/,
|
|
1064
|
+
out: Any = None,
|
|
1065
|
+
*outputs: Any,
|
|
1066
|
+
**kwargs: Any,
|
|
1067
|
+
) -> tuple[ndarray[Shape], ndarray[Shape]]: ...
|
|
1068
|
+
@overload
|
|
1069
|
+
def __call__[Shape: _Shape](
|
|
1070
|
+
self,
|
|
1071
|
+
x1: Any,
|
|
1072
|
+
x2: ndarray[Shape],
|
|
1073
|
+
/,
|
|
1074
|
+
out: Any = None,
|
|
1075
|
+
*outputs: Any,
|
|
1076
|
+
**kwargs: Any,
|
|
1077
|
+
) -> tuple[ndarray[Shape], ndarray[Shape]]: ...
|
|
1078
|
+
@overload
|
|
1079
|
+
def __call__(
|
|
1080
|
+
self,
|
|
1081
|
+
x1: Any,
|
|
1082
|
+
x2: Any,
|
|
1083
|
+
/,
|
|
1084
|
+
out: Any = None,
|
|
1085
|
+
*outputs: Any,
|
|
1086
|
+
**kwargs: Any,
|
|
1087
|
+
) -> tuple[Any, Any]: ...
|
|
1088
|
+
|
|
1089
|
+
class _MatvecUFunc(ufunc):
|
|
1090
|
+
@overload
|
|
1091
|
+
def __call__[Shape1: _Shape, Shape2: _Shape](
|
|
1092
|
+
self,
|
|
1093
|
+
x1: ndarray[Shape1],
|
|
1094
|
+
x2: ndarray[Shape2],
|
|
1095
|
+
/,
|
|
1096
|
+
out: Any = None,
|
|
1097
|
+
**kwargs: Any,
|
|
1098
|
+
) -> ndarray[matvec_shape(Shape1, Shape2)]: ...
|
|
1099
|
+
@overload
|
|
1100
|
+
def __call__(self, x1: Any, x2: Any, /, out: Any = None, **kwargs: Any) -> Any: ...
|
|
1101
|
+
|
|
1102
|
+
class _VecdotUFunc(ufunc):
|
|
1103
|
+
@overload
|
|
1104
|
+
def __call__[Shape1: _Shape, Shape2: _Shape](
|
|
1105
|
+
self,
|
|
1106
|
+
x1: ndarray[Shape1],
|
|
1107
|
+
x2: ndarray[Shape2],
|
|
1108
|
+
/,
|
|
1109
|
+
out: Any = None,
|
|
1110
|
+
**kwargs: Any,
|
|
1111
|
+
) -> ndarray[vecdot_shape(Shape1, Shape2)]: ...
|
|
1112
|
+
@overload
|
|
1113
|
+
def __call__(self, x1: Any, x2: Any, /, out: Any = None, **kwargs: Any) -> Any: ...
|
|
1114
|
+
|
|
1115
|
+
class _VecmatUFunc(ufunc):
|
|
1116
|
+
@overload
|
|
1117
|
+
def __call__[Shape1: _Shape, Shape2: _Shape](
|
|
1118
|
+
self,
|
|
1119
|
+
x1: ndarray[Shape1],
|
|
1120
|
+
x2: ndarray[Shape2],
|
|
1121
|
+
/,
|
|
1122
|
+
out: Any = None,
|
|
1123
|
+
**kwargs: Any,
|
|
1124
|
+
) -> ndarray[vecmat_shape(Shape1, Shape2)]: ...
|
|
1125
|
+
@overload
|
|
1126
|
+
def __call__(self, x1: Any, x2: Any, /, out: Any = None, **kwargs: Any) -> Any: ...
|
|
1127
|
+
|
|
1128
|
+
abs: _UnaryUFunc
|
|
1129
|
+
absolute: _UnaryUFunc
|
|
1130
|
+
acos: _UnaryUFunc
|
|
1131
|
+
acosh: _UnaryUFunc
|
|
1132
|
+
arccos: _UnaryUFunc
|
|
1133
|
+
arccosh: _UnaryUFunc
|
|
1134
|
+
arcsin: _UnaryUFunc
|
|
1135
|
+
arcsinh: _UnaryUFunc
|
|
1136
|
+
arctan: _UnaryUFunc
|
|
1137
|
+
arctanh: _UnaryUFunc
|
|
1138
|
+
asin: _UnaryUFunc
|
|
1139
|
+
asinh: _UnaryUFunc
|
|
1140
|
+
atan: _UnaryUFunc
|
|
1141
|
+
atanh: _UnaryUFunc
|
|
1142
|
+
bitwise_count: _UnaryUFunc
|
|
1143
|
+
bitwise_invert: _UnaryUFunc
|
|
1144
|
+
bitwise_not: _UnaryUFunc
|
|
1145
|
+
cbrt: _UnaryUFunc
|
|
1146
|
+
ceil: _UnaryUFunc
|
|
1147
|
+
conj: _UnaryUFunc
|
|
1148
|
+
conjugate: _UnaryUFunc
|
|
1149
|
+
cos: _UnaryUFunc
|
|
1150
|
+
cosh: _UnaryUFunc
|
|
1151
|
+
deg2rad: _UnaryUFunc
|
|
1152
|
+
degrees: _UnaryUFunc
|
|
1153
|
+
exp: _UnaryUFunc
|
|
1154
|
+
exp2: _UnaryUFunc
|
|
1155
|
+
expm1: _UnaryUFunc
|
|
1156
|
+
fabs: _UnaryUFunc
|
|
1157
|
+
floor: _UnaryUFunc
|
|
1158
|
+
invert: _UnaryUFunc
|
|
1159
|
+
isfinite: _UnaryUFunc
|
|
1160
|
+
isinf: _UnaryUFunc
|
|
1161
|
+
isnan: _UnaryUFunc
|
|
1162
|
+
isnat: _UnaryUFunc
|
|
1163
|
+
log: _UnaryUFunc
|
|
1164
|
+
log10: _UnaryUFunc
|
|
1165
|
+
log1p: _UnaryUFunc
|
|
1166
|
+
log2: _UnaryUFunc
|
|
1167
|
+
logical_not: _UnaryUFunc
|
|
1168
|
+
negative: _UnaryUFunc
|
|
1169
|
+
positive: _UnaryUFunc
|
|
1170
|
+
rad2deg: _UnaryUFunc
|
|
1171
|
+
radians: _UnaryUFunc
|
|
1172
|
+
reciprocal: _UnaryUFunc
|
|
1173
|
+
rint: _UnaryUFunc
|
|
1174
|
+
sign: _UnaryUFunc
|
|
1175
|
+
signbit: _UnaryUFunc
|
|
1176
|
+
sin: _UnaryUFunc
|
|
1177
|
+
sinh: _UnaryUFunc
|
|
1178
|
+
spacing: _UnaryUFunc
|
|
1179
|
+
sqrt: _UnaryUFunc
|
|
1180
|
+
square: _UnaryUFunc
|
|
1181
|
+
tan: _UnaryUFunc
|
|
1182
|
+
tanh: _UnaryUFunc
|
|
1183
|
+
trunc: _UnaryUFunc
|
|
198
1184
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
1185
|
+
add: _BinaryUFunc
|
|
1186
|
+
arctan2: _BinaryUFunc
|
|
1187
|
+
atan2: _BinaryUFunc
|
|
1188
|
+
bitwise_and: _BinaryUFunc
|
|
1189
|
+
bitwise_left_shift: _BinaryUFunc
|
|
1190
|
+
bitwise_or: _BinaryUFunc
|
|
1191
|
+
bitwise_right_shift: _BinaryUFunc
|
|
1192
|
+
bitwise_xor: _BinaryUFunc
|
|
1193
|
+
copysign: _BinaryUFunc
|
|
1194
|
+
divide: _BinaryUFunc
|
|
1195
|
+
equal: _BinaryUFunc
|
|
1196
|
+
float_power: _BinaryUFunc
|
|
1197
|
+
floor_divide: _BinaryUFunc
|
|
1198
|
+
fmax: _BinaryUFunc
|
|
1199
|
+
fmin: _BinaryUFunc
|
|
1200
|
+
fmod: _BinaryUFunc
|
|
1201
|
+
gcd: _BinaryUFunc
|
|
1202
|
+
greater: _BinaryUFunc
|
|
1203
|
+
greater_equal: _BinaryUFunc
|
|
1204
|
+
heaviside: _BinaryUFunc
|
|
1205
|
+
hypot: _BinaryUFunc
|
|
1206
|
+
lcm: _BinaryUFunc
|
|
1207
|
+
ldexp: _BinaryUFunc
|
|
1208
|
+
left_shift: _BinaryUFunc
|
|
1209
|
+
less: _BinaryUFunc
|
|
1210
|
+
less_equal: _BinaryUFunc
|
|
1211
|
+
logaddexp: _BinaryUFunc
|
|
1212
|
+
logaddexp2: _BinaryUFunc
|
|
1213
|
+
logical_and: _BinaryUFunc
|
|
1214
|
+
logical_or: _BinaryUFunc
|
|
1215
|
+
logical_xor: _BinaryUFunc
|
|
1216
|
+
matmul: _MatmulUFunc
|
|
1217
|
+
maximum: _BinaryUFunc
|
|
1218
|
+
minimum: _BinaryUFunc
|
|
1219
|
+
mod: _BinaryUFunc
|
|
1220
|
+
multiply: _BinaryUFunc
|
|
1221
|
+
nextafter: _BinaryUFunc
|
|
1222
|
+
not_equal: _BinaryUFunc
|
|
1223
|
+
pow: _BinaryUFunc
|
|
1224
|
+
power: _BinaryUFunc
|
|
1225
|
+
remainder: _BinaryUFunc
|
|
1226
|
+
right_shift: _BinaryUFunc
|
|
1227
|
+
subtract: _BinaryUFunc
|
|
1228
|
+
true_divide: _BinaryUFunc
|
|
1229
|
+
|
|
1230
|
+
frexp: _UnaryTwoOutputUFunc
|
|
1231
|
+
modf: _UnaryTwoOutputUFunc
|
|
1232
|
+
divmod: _BinaryTwoOutputUFunc
|
|
1233
|
+
matvec: _MatvecUFunc
|
|
1234
|
+
vecdot: _VecdotUFunc
|
|
1235
|
+
vecmat: _VecmatUFunc
|
|
1236
|
+
|
|
1237
|
+
# Constructor overloads preserve dtype only when it is omitted, preserve shape only for
|
|
1238
|
+
# `ndmin=0`, and delegate non-None `like` dispatch with an `Any` result.
|
|
1239
|
+
@overload
|
|
1240
|
+
def array[Shape: _Shape, DType](
|
|
1241
|
+
object: ndarray[Shape, DType],
|
|
1242
|
+
dtype: None = None,
|
|
1243
|
+
*,
|
|
1244
|
+
copy: bool | None = ...,
|
|
1245
|
+
order: str | None = None,
|
|
1246
|
+
subok: bool = ...,
|
|
1247
|
+
ndmin: Literal[0] = 0,
|
|
1248
|
+
like: None = None,
|
|
1249
|
+
) -> ndarray[Shape, DType]: ...
|
|
1250
|
+
@overload
|
|
1251
|
+
def array[Shape: _Shape](
|
|
1252
|
+
object: ndarray[Shape, Any],
|
|
1253
|
+
dtype: Any,
|
|
1254
|
+
*,
|
|
1255
|
+
copy: bool | None = ...,
|
|
1256
|
+
order: str | None = None,
|
|
1257
|
+
subok: bool = ...,
|
|
1258
|
+
ndmin: Literal[0] = 0,
|
|
1259
|
+
like: None = None,
|
|
1260
|
+
) -> ndarray[Shape]: ...
|
|
1261
|
+
@overload
|
|
1262
|
+
def array[Shape: _Shape = []](
|
|
1263
|
+
object: _ArrayScalar | RegularNestedList[Shape, _ArrayScalar],
|
|
1264
|
+
dtype: Any = ...,
|
|
1265
|
+
*,
|
|
1266
|
+
copy: bool | None = ...,
|
|
1267
|
+
order: str | None = None,
|
|
1268
|
+
subok: bool = ...,
|
|
1269
|
+
ndmin: Literal[0] = 0,
|
|
1270
|
+
like: None = None,
|
|
1271
|
+
) -> ndarray[Shape]: ...
|
|
1272
|
+
@overload
|
|
1273
|
+
def array(
|
|
1274
|
+
object: Any,
|
|
1275
|
+
dtype: Any = ...,
|
|
1276
|
+
*,
|
|
1277
|
+
copy: bool | None = ...,
|
|
1278
|
+
order: str | None = None,
|
|
1279
|
+
subok: bool = ...,
|
|
1280
|
+
ndmin: int = ...,
|
|
1281
|
+
like: None = None,
|
|
1282
|
+
) -> ndarray[IntTuple]: ...
|
|
1283
|
+
@overload
|
|
1284
|
+
def array(
|
|
1285
|
+
object: Any,
|
|
1286
|
+
dtype: Any = ...,
|
|
1287
|
+
*,
|
|
1288
|
+
copy: bool | None = ...,
|
|
1289
|
+
order: str | None = None,
|
|
1290
|
+
subok: bool = ...,
|
|
1291
|
+
ndmin: int = ...,
|
|
1292
|
+
like: Any,
|
|
1293
|
+
) -> Any: ...
|
|
1294
|
+
@overload
|
|
1295
|
+
def asarray[Shape: _Shape, DType](
|
|
1296
|
+
a: ndarray[Shape, DType],
|
|
1297
|
+
dtype: None = None,
|
|
1298
|
+
order: str | None = None,
|
|
1299
|
+
*,
|
|
1300
|
+
device: Any = ...,
|
|
1301
|
+
copy: bool | None = ...,
|
|
1302
|
+
like: None = None,
|
|
1303
|
+
) -> ndarray[Shape, DType]: ...
|
|
1304
|
+
@overload
|
|
1305
|
+
def asarray[Shape: _Shape](
|
|
1306
|
+
a: ndarray[Shape, Any],
|
|
1307
|
+
dtype: Any,
|
|
1308
|
+
order: str | None = None,
|
|
1309
|
+
*,
|
|
1310
|
+
device: Any = ...,
|
|
1311
|
+
copy: bool | None = ...,
|
|
1312
|
+
like: None = None,
|
|
1313
|
+
) -> ndarray[Shape]: ...
|
|
1314
|
+
@overload
|
|
1315
|
+
def asarray[Shape: _Shape = []](
|
|
1316
|
+
a: _ArrayScalar | RegularNestedList[Shape, _ArrayScalar],
|
|
1317
|
+
dtype: Any = ...,
|
|
1318
|
+
order: str | None = None,
|
|
1319
|
+
*,
|
|
1320
|
+
device: Any = ...,
|
|
1321
|
+
copy: bool | None = ...,
|
|
1322
|
+
like: None = None,
|
|
1323
|
+
) -> ndarray[Shape]: ...
|
|
1324
|
+
@overload
|
|
1325
|
+
def asarray(
|
|
1326
|
+
a: Any,
|
|
1327
|
+
dtype: Any = ...,
|
|
1328
|
+
order: str | None = None,
|
|
1329
|
+
*,
|
|
1330
|
+
device: Any = ...,
|
|
1331
|
+
copy: bool | None = ...,
|
|
1332
|
+
like: None = None,
|
|
1333
|
+
) -> ndarray[IntTuple]: ...
|
|
1334
|
+
@overload
|
|
1335
|
+
def asarray(
|
|
1336
|
+
a: Any,
|
|
1337
|
+
dtype: Any = ...,
|
|
1338
|
+
order: str | None = None,
|
|
1339
|
+
*,
|
|
1340
|
+
device: Any = ...,
|
|
1341
|
+
copy: bool | None = ...,
|
|
1342
|
+
like: Any,
|
|
1343
|
+
) -> Any: ...
|
|
221
1344
|
def round[Shape: _Shape](x: ndarray[Shape]) -> ndarray[Shape]: ...
|
|
222
|
-
|
|
1345
|
+
@overload
|
|
223
1346
|
def clip[Shape: _Shape](
|
|
224
1347
|
a: ndarray[Shape], a_min: int | float, a_max: int | float
|
|
225
1348
|
) -> ndarray[Shape]: ...
|
|
226
|
-
|
|
1349
|
+
@overload
|
|
1350
|
+
def clip(a: ArrayLike, a_min: ArrayLike | None, a_max: ArrayLike | None) -> Any: ...
|
|
227
1351
|
def fill_diagonal[N: IntVar, DType](
|
|
228
1352
|
a: ndarray[[N, N], DType],
|
|
229
1353
|
val: Any,
|
|
230
|
-
wrap:
|
|
1354
|
+
wrap: py_bool = False,
|
|
231
1355
|
) -> None: ...
|
|
232
1356
|
@overload
|
|
233
1357
|
def diag[N: IntVar, DType, K: Flag[int] = 0](
|
|
@@ -242,10 +1366,8 @@ def diag[M: IntVar, N: IntVar, DType](
|
|
|
242
1366
|
|
|
243
1367
|
# Trailing fallback for ranks the precise overloads do not model, so their dtype survives
|
|
244
1368
|
# instead of degrading to `Any`. The parameter shape is a type variable rather than
|
|
245
|
-
# `
|
|
1369
|
+
# `IntTuple`: a gradual parameter shape would also match known-rank arguments whose dtype is
|
|
246
1370
|
# gradual, and that ambiguity collapses their precise result to a gradual shape.
|
|
247
|
-
# The result is spelled `IntTuple`, the shape bound itself, rather than `_AnyShape`:
|
|
248
|
-
# an unbounded tuple is not a valid shaped-array carrier. Both infer the same shape.
|
|
249
1371
|
@overload
|
|
250
1372
|
def diag[S: _Shape, DType](
|
|
251
1373
|
v: ndarray[S, DType], k: int = 0
|
|
@@ -272,7 +1394,7 @@ def sum[
|
|
|
272
1394
|
Shape: _Shape,
|
|
273
1395
|
DType,
|
|
274
1396
|
Axis: Flag[_Axis],
|
|
275
|
-
KeepDims: Flag[
|
|
1397
|
+
KeepDims: Flag[py_bool],
|
|
276
1398
|
](
|
|
277
1399
|
a: ndarray[Shape, DType], axis: Axis = None, *, keepdims: KeepDims = False
|
|
278
1400
|
) -> ndarray[reduce_shape(Shape, Axis, KeepDims), Any]: ...
|
|
@@ -280,27 +1402,37 @@ def mean[
|
|
|
280
1402
|
Shape: _Shape,
|
|
281
1403
|
DType,
|
|
282
1404
|
Axis: Flag[_Axis],
|
|
283
|
-
KeepDims: Flag[
|
|
1405
|
+
KeepDims: Flag[py_bool],
|
|
284
1406
|
](
|
|
285
1407
|
a: ndarray[Shape, DType], axis: Axis = None, *, keepdims: KeepDims = False
|
|
286
1408
|
) -> ndarray[reduce_shape(Shape, Axis, KeepDims), Any]: ...
|
|
1409
|
+
@overload
|
|
287
1410
|
def min[
|
|
288
1411
|
Shape: _Shape,
|
|
289
1412
|
DType,
|
|
290
1413
|
Axis: Flag[_Axis],
|
|
291
|
-
KeepDims: Flag[
|
|
1414
|
+
KeepDims: Flag[py_bool],
|
|
292
1415
|
](
|
|
293
1416
|
a: ndarray[Shape, DType], axis: Axis = None, *, keepdims: KeepDims = False
|
|
294
1417
|
) -> ndarray[reduce_shape(Shape, Axis, KeepDims), Any]: ...
|
|
1418
|
+
@overload
|
|
1419
|
+
def min(
|
|
1420
|
+
a: Sequence[ArrayLike], axis: _Axis = None, *, keepdims: py_bool = False
|
|
1421
|
+
) -> Any: ...
|
|
1422
|
+
@overload
|
|
295
1423
|
def max[
|
|
296
1424
|
Shape: _Shape,
|
|
297
1425
|
DType,
|
|
298
1426
|
Axis: Flag[_Axis],
|
|
299
|
-
KeepDims: Flag[
|
|
1427
|
+
KeepDims: Flag[py_bool],
|
|
300
1428
|
](
|
|
301
1429
|
a: ndarray[Shape, DType], axis: Axis = None, *, keepdims: KeepDims = False
|
|
302
1430
|
) -> ndarray[reduce_shape(Shape, Axis, KeepDims), Any]: ...
|
|
303
1431
|
@overload
|
|
1432
|
+
def max(
|
|
1433
|
+
a: Sequence[ArrayLike], axis: _Axis = None, *, keepdims: py_bool = False
|
|
1434
|
+
) -> Any: ...
|
|
1435
|
+
@overload
|
|
304
1436
|
def argmin[N: IntVar, M: IntVar](
|
|
305
1437
|
a: ndarray[[N, M]],
|
|
306
1438
|
axis: Literal[0, -2],
|
|
@@ -315,15 +1447,9 @@ def argmin[N: IntVar, M: IntVar](
|
|
|
315
1447
|
keepdims: Literal[False] = False,
|
|
316
1448
|
) -> ndarray[[N], dtype[intp]]: ...
|
|
317
1449
|
|
|
318
|
-
# The result dtype stays gradual because dtype promotion is not modeled, while
|
|
319
|
-
# `ndarray.__matmul__` carries the left operand's dtype.
|
|
320
|
-
def matmul[LeftShape: _Shape, RightShape: _Shape](
|
|
321
|
-
a: ndarray[LeftShape], b: ndarray[RightShape], /
|
|
322
|
-
) -> ndarray[matmul_shape(LeftShape, RightShape), Any]: ...
|
|
323
|
-
|
|
324
1450
|
# TODO(stroxler): Replace these finite tuple-shape constructor overloads with a
|
|
325
|
-
# generic `Shape: tuple[int, ...]` overload once
|
|
326
|
-
# downstream
|
|
1451
|
+
# generic `Shape: tuple[int, ...]` overload once whole-shape parameters flow
|
|
1452
|
+
# through downstream array operations without degrading to unknown.
|
|
327
1453
|
@overload
|
|
328
1454
|
def zeros[N: IntVar, ScalarT: generic](
|
|
329
1455
|
shape: Int[N], dtype: type[ScalarT], order: str = ...
|
|
@@ -564,3 +1690,51 @@ def identity[N: IntVar](
|
|
|
564
1690
|
def identity[N: IntVar](
|
|
565
1691
|
n: Int[N], dtype: Any, *, like: Any = ...
|
|
566
1692
|
) -> ndarray[[N, N]]: ...
|
|
1693
|
+
|
|
1694
|
+
# TODO(stroxler): Replace these placeholders with NumPy's scalar type hierarchy.
|
|
1695
|
+
bool: Any
|
|
1696
|
+
broadcast: Any
|
|
1697
|
+
byte: Any
|
|
1698
|
+
bytes_: Any
|
|
1699
|
+
cdouble: Any
|
|
1700
|
+
character: Any
|
|
1701
|
+
clongdouble: Any
|
|
1702
|
+
complex128: Any
|
|
1703
|
+
complex64: Any
|
|
1704
|
+
complexfloating: Any
|
|
1705
|
+
csingle: Any
|
|
1706
|
+
datetime64: Any
|
|
1707
|
+
double: Any
|
|
1708
|
+
flexible: Any
|
|
1709
|
+
float16: Any
|
|
1710
|
+
floating: Any
|
|
1711
|
+
half: Any
|
|
1712
|
+
inexact: Any
|
|
1713
|
+
int16: Any
|
|
1714
|
+
int8: Any
|
|
1715
|
+
int_: Any
|
|
1716
|
+
intc: Any
|
|
1717
|
+
integer: Any
|
|
1718
|
+
long: Any
|
|
1719
|
+
longdouble: Any
|
|
1720
|
+
longlong: Any
|
|
1721
|
+
number: Any
|
|
1722
|
+
object_: Any
|
|
1723
|
+
short: Any
|
|
1724
|
+
signedinteger: Any
|
|
1725
|
+
single: Any
|
|
1726
|
+
str_: Any
|
|
1727
|
+
timedelta64: Any
|
|
1728
|
+
ubyte: Any
|
|
1729
|
+
uint: Any
|
|
1730
|
+
uint16: Any
|
|
1731
|
+
uint32: Any
|
|
1732
|
+
uint64: Any
|
|
1733
|
+
uint8: Any
|
|
1734
|
+
uintc: Any
|
|
1735
|
+
uintp: Any
|
|
1736
|
+
ulong: Any
|
|
1737
|
+
ulonglong: Any
|
|
1738
|
+
unsignedinteger: Any
|
|
1739
|
+
ushort: Any
|
|
1740
|
+
void: Any
|