egglog 6.0.0__cp310-none-win_amd64.whl → 6.1.0__cp310-none-win_amd64.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.

Potentially problematic release.


This version of egglog might be problematic. Click here for more details.

egglog/exp/array_api.py CHANGED
@@ -25,8 +25,7 @@ if TYPE_CHECKING:
25
25
  numbers.Integral.register(RuntimeExpr)
26
26
 
27
27
  array_api_ruleset = ruleset()
28
- # Saturate doesn't work for some reason, so just set a high number here
29
- array_api_schedule = array_api_ruleset * 100000
28
+ array_api_schedule = array_api_ruleset.saturate()
30
29
 
31
30
 
32
31
  class Boolean(Expr):
@@ -35,14 +34,11 @@ class Boolean(Expr):
35
34
  return try_evaling(self, self.bool)
36
35
 
37
36
  @property
38
- def bool(self) -> Bool:
39
- ...
37
+ def bool(self) -> Bool: ...
40
38
 
41
- def __or__(self, other: Boolean) -> Boolean:
42
- ...
39
+ def __or__(self, other: Boolean) -> Boolean: ...
43
40
 
44
- def __and__(self, other: Boolean) -> Boolean:
45
- ...
41
+ def __and__(self, other: Boolean) -> Boolean: ...
46
42
 
47
43
 
48
44
  TRUE = constant("TRUE", Boolean)
@@ -92,22 +88,18 @@ class IsDtypeKind(Expr):
92
88
  NULL: ClassVar[IsDtypeKind]
93
89
 
94
90
  @classmethod
95
- def string(cls, s: StringLike) -> IsDtypeKind:
96
- ...
91
+ def string(cls, s: StringLike) -> IsDtypeKind: ...
97
92
 
98
93
  @classmethod
99
- def dtype(cls, d: DType) -> IsDtypeKind:
100
- ...
94
+ def dtype(cls, d: DType) -> IsDtypeKind: ...
101
95
 
102
96
  @method(cost=10)
103
- def __or__(self, other: IsDtypeKind) -> IsDtypeKind:
104
- ...
97
+ def __or__(self, other: IsDtypeKind) -> IsDtypeKind: ...
105
98
 
106
99
 
107
100
  # TODO: Make kind more generic to support tuples.
108
101
  @function
109
- def isdtype(dtype: DType, kind: IsDtypeKind) -> Boolean:
110
- ...
102
+ def isdtype(dtype: DType, kind: IsDtypeKind) -> Boolean: ...
111
103
 
112
104
 
113
105
  converter(DType, IsDtypeKind, lambda x: IsDtypeKind.dtype(x))
@@ -143,17 +135,13 @@ def _isdtype(d: DType, k1: IsDtypeKind, k2: IsDtypeKind):
143
135
 
144
136
 
145
137
  class Int(Expr):
146
- def __init__(self, value: i64Like) -> None:
147
- ...
138
+ def __init__(self, value: i64Like) -> None: ...
148
139
 
149
- def __invert__(self) -> Int:
150
- ...
140
+ def __invert__(self) -> Int: ...
151
141
 
152
- def __lt__(self, other: Int) -> Boolean:
153
- ...
142
+ def __lt__(self, other: Int) -> Boolean: ...
154
143
 
155
- def __le__(self, other: Int) -> Boolean:
156
- ...
144
+ def __le__(self, other: Int) -> Boolean: ...
157
145
 
158
146
  def __eq__(self, other: Int) -> Boolean: # type: ignore[override]
159
147
  ...
@@ -164,93 +152,64 @@ class Int(Expr):
164
152
  def __ne__(self, other: Int) -> bool: # type: ignore[override]
165
153
  return not (self == other)
166
154
 
167
- def __gt__(self, other: Int) -> Boolean:
168
- ...
155
+ def __gt__(self, other: Int) -> Boolean: ...
169
156
 
170
- def __ge__(self, other: Int) -> Boolean:
171
- ...
157
+ def __ge__(self, other: Int) -> Boolean: ...
172
158
 
173
- def __add__(self, other: Int) -> Int:
174
- ...
159
+ def __add__(self, other: Int) -> Int: ...
175
160
 
176
- def __sub__(self, other: Int) -> Int:
177
- ...
161
+ def __sub__(self, other: Int) -> Int: ...
178
162
 
179
- def __mul__(self, other: Int) -> Int:
180
- ...
163
+ def __mul__(self, other: Int) -> Int: ...
181
164
 
182
- def __truediv__(self, other: Int) -> Int:
183
- ...
165
+ def __truediv__(self, other: Int) -> Int: ...
184
166
 
185
- def __floordiv__(self, other: Int) -> Int:
186
- ...
167
+ def __floordiv__(self, other: Int) -> Int: ...
187
168
 
188
- def __mod__(self, other: Int) -> Int:
189
- ...
169
+ def __mod__(self, other: Int) -> Int: ...
190
170
 
191
- def __divmod__(self, other: Int) -> Int:
192
- ...
171
+ def __divmod__(self, other: Int) -> Int: ...
193
172
 
194
- def __pow__(self, other: Int) -> Int:
195
- ...
173
+ def __pow__(self, other: Int) -> Int: ...
196
174
 
197
- def __lshift__(self, other: Int) -> Int:
198
- ...
175
+ def __lshift__(self, other: Int) -> Int: ...
199
176
 
200
- def __rshift__(self, other: Int) -> Int:
201
- ...
177
+ def __rshift__(self, other: Int) -> Int: ...
202
178
 
203
- def __and__(self, other: Int) -> Int:
204
- ...
179
+ def __and__(self, other: Int) -> Int: ...
205
180
 
206
- def __xor__(self, other: Int) -> Int:
207
- ...
181
+ def __xor__(self, other: Int) -> Int: ...
208
182
 
209
- def __or__(self, other: Int) -> Int:
210
- ...
183
+ def __or__(self, other: Int) -> Int: ...
211
184
 
212
- def __radd__(self, other: Int) -> Int:
213
- ...
185
+ def __radd__(self, other: Int) -> Int: ...
214
186
 
215
- def __rsub__(self, other: Int) -> Int:
216
- ...
187
+ def __rsub__(self, other: Int) -> Int: ...
217
188
 
218
- def __rmul__(self, other: Int) -> Int:
219
- ...
189
+ def __rmul__(self, other: Int) -> Int: ...
220
190
 
221
- def __rmatmul__(self, other: Int) -> Int:
222
- ...
191
+ def __rmatmul__(self, other: Int) -> Int: ...
223
192
 
224
- def __rtruediv__(self, other: Int) -> Int:
225
- ...
193
+ def __rtruediv__(self, other: Int) -> Int: ...
226
194
 
227
- def __rfloordiv__(self, other: Int) -> Int:
228
- ...
195
+ def __rfloordiv__(self, other: Int) -> Int: ...
229
196
 
230
- def __rmod__(self, other: Int) -> Int:
231
- ...
197
+ def __rmod__(self, other: Int) -> Int: ...
232
198
 
233
- def __rpow__(self, other: Int) -> Int:
234
- ...
199
+ def __rpow__(self, other: Int) -> Int: ...
235
200
 
236
- def __rlshift__(self, other: Int) -> Int:
237
- ...
201
+ def __rlshift__(self, other: Int) -> Int: ...
238
202
 
239
- def __rrshift__(self, other: Int) -> Int:
240
- ...
203
+ def __rrshift__(self, other: Int) -> Int: ...
241
204
 
242
- def __rand__(self, other: Int) -> Int:
243
- ...
205
+ def __rand__(self, other: Int) -> Int: ...
244
206
 
245
- def __rxor__(self, other: Int) -> Int:
246
- ...
207
+ def __rxor__(self, other: Int) -> Int: ...
247
208
 
248
- def __ror__(self, other: Int) -> Int:
249
- ...
209
+ def __ror__(self, other: Int) -> Int: ...
250
210
 
251
211
  @property
252
- def i64(self) -> i64:
253
- ...
212
+ def i64(self) -> i64: ...
254
213
 
255
214
  @method(preserve=True)
256
215
  def __int__(self) -> int:
@@ -305,31 +264,23 @@ converter(int, Int, lambda x: Int(x))
305
264
 
306
265
 
307
266
  class Float(Expr):
308
- def __init__(self, value: f64Like) -> None:
309
- ...
267
+ def __init__(self, value: f64Like) -> None: ...
310
268
 
311
- def abs(self) -> Float:
312
- ...
269
+ def abs(self) -> Float: ...
313
270
 
314
271
  @classmethod
315
- def rational(cls, r: Rational) -> Float:
316
- ...
272
+ def rational(cls, r: Rational) -> Float: ...
317
273
 
318
274
  @classmethod
319
- def from_int(cls, i: Int) -> Float:
320
- ...
275
+ def from_int(cls, i: Int) -> Float: ...
321
276
 
322
- def __truediv__(self, other: Float) -> Float:
323
- ...
277
+ def __truediv__(self, other: Float) -> Float: ...
324
278
 
325
- def __mul__(self, other: Float) -> Float:
326
- ...
279
+ def __mul__(self, other: Float) -> Float: ...
327
280
 
328
- def __add__(self, other: Float) -> Float:
329
- ...
281
+ def __add__(self, other: Float) -> Float: ...
330
282
 
331
- def __sub__(self, other: Float) -> Float:
332
- ...
283
+ def __sub__(self, other: Float) -> Float: ...
333
284
 
334
285
 
335
286
  converter(float, Float, lambda x: Float(x))
@@ -357,14 +308,11 @@ def _float(f: f64, f2: f64, i: i64, r: Rational, r1: Rational):
357
308
  class TupleInt(Expr):
358
309
  EMPTY: ClassVar[TupleInt]
359
310
 
360
- def __init__(self, head: Int) -> None:
361
- ...
311
+ def __init__(self, head: Int) -> None: ...
362
312
 
363
- def __add__(self, other: TupleInt) -> TupleInt:
364
- ...
313
+ def __add__(self, other: TupleInt) -> TupleInt: ...
365
314
 
366
- def length(self) -> Int:
367
- ...
315
+ def length(self) -> Int: ...
368
316
 
369
317
  @method(preserve=True)
370
318
  def __len__(self) -> int:
@@ -374,11 +322,9 @@ class TupleInt(Expr):
374
322
  def __iter__(self) -> Iterator[Int]:
375
323
  return iter(self[Int(i)] for i in range(len(self)))
376
324
 
377
- def __getitem__(self, i: Int) -> Int:
378
- ...
325
+ def __getitem__(self, i: Int) -> Int: ...
379
326
 
380
- def product(self) -> Int:
381
- ...
327
+ def product(self) -> Int: ...
382
328
 
383
329
 
384
330
  converter(
@@ -413,8 +359,7 @@ class OptionalInt(Expr):
413
359
  none: ClassVar[OptionalInt]
414
360
 
415
361
  @classmethod
416
- def some(cls, value: Int) -> OptionalInt:
417
- ...
362
+ def some(cls, value: Int) -> OptionalInt: ...
418
363
 
419
364
 
420
365
  converter(type(None), OptionalInt, lambda _: OptionalInt.none)
@@ -427,8 +372,7 @@ class Slice(Expr):
427
372
  start: OptionalInt = OptionalInt.none,
428
373
  stop: OptionalInt = OptionalInt.none,
429
374
  step: OptionalInt = OptionalInt.none,
430
- ) -> None:
431
- ...
375
+ ) -> None: ...
432
376
 
433
377
 
434
378
  converter(
@@ -443,12 +387,10 @@ class MultiAxisIndexKeyItem(Expr):
443
387
  NONE: ClassVar[MultiAxisIndexKeyItem]
444
388
 
445
389
  @classmethod
446
- def int(cls, i: Int) -> MultiAxisIndexKeyItem:
447
- ...
390
+ def int(cls, i: Int) -> MultiAxisIndexKeyItem: ...
448
391
 
449
392
  @classmethod
450
- def slice(cls, slice: Slice) -> MultiAxisIndexKeyItem:
451
- ...
393
+ def slice(cls, slice: Slice) -> MultiAxisIndexKeyItem: ...
452
394
 
453
395
 
454
396
  converter(type(...), MultiAxisIndexKeyItem, lambda _: MultiAxisIndexKeyItem.ELLIPSIS)
@@ -458,13 +400,11 @@ converter(Slice, MultiAxisIndexKeyItem, MultiAxisIndexKeyItem.slice)
458
400
 
459
401
 
460
402
  class MultiAxisIndexKey(Expr):
461
- def __init__(self, item: MultiAxisIndexKeyItem) -> None:
462
- ...
403
+ def __init__(self, item: MultiAxisIndexKeyItem) -> None: ...
463
404
 
464
405
  EMPTY: ClassVar[MultiAxisIndexKey]
465
406
 
466
- def __add__(self, other: MultiAxisIndexKey) -> MultiAxisIndexKey:
467
- ...
407
+ def __add__(self, other: MultiAxisIndexKey) -> MultiAxisIndexKey: ...
468
408
 
469
409
 
470
410
  converter(
@@ -492,12 +432,10 @@ class IndexKey(Expr):
492
432
  ELLIPSIS: ClassVar[IndexKey]
493
433
 
494
434
  @classmethod
495
- def int(cls, i: Int) -> IndexKey:
496
- ...
435
+ def int(cls, i: Int) -> IndexKey: ...
497
436
 
498
437
  @classmethod
499
- def slice(cls, slice: Slice) -> IndexKey:
500
- ...
438
+ def slice(cls, slice: Slice) -> IndexKey: ...
501
439
 
502
440
  # Disabled until we support late binding
503
441
  # @classmethod
@@ -505,8 +443,7 @@ class IndexKey(Expr):
505
443
  # ...
506
444
 
507
445
  @classmethod
508
- def multi_axis(cls, key: MultiAxisIndexKey) -> IndexKey:
509
- ...
446
+ def multi_axis(cls, key: MultiAxisIndexKey) -> IndexKey: ...
510
447
 
511
448
 
512
449
  converter(type(...), IndexKey, lambda _: IndexKey.ELLIPSIS)
@@ -515,8 +452,7 @@ converter(Slice, IndexKey, IndexKey.slice)
515
452
  converter(MultiAxisIndexKey, IndexKey, IndexKey.multi_axis)
516
453
 
517
454
 
518
- class Device(Expr):
519
- ...
455
+ class Device(Expr): ...
520
456
 
521
457
 
522
458
  ALL_INDICES: TupleInt = constant("ALL_INDICES", TupleInt)
@@ -528,28 +464,21 @@ ALL_INDICES: TupleInt = constant("ALL_INDICES", TupleInt)
528
464
 
529
465
  class Value(Expr):
530
466
  @classmethod
531
- def int(cls, i: Int) -> Value:
532
- ...
467
+ def int(cls, i: Int) -> Value: ...
533
468
 
534
469
  @classmethod
535
- def float(cls, f: Float) -> Value:
536
- ...
470
+ def float(cls, f: Float) -> Value: ...
537
471
 
538
472
  @classmethod
539
- def bool(cls, b: Boolean) -> Value:
540
- ...
473
+ def bool(cls, b: Boolean) -> Value: ...
541
474
 
542
- def isfinite(self) -> Boolean:
543
- ...
475
+ def isfinite(self) -> Boolean: ...
544
476
 
545
- def __lt__(self, other: Value) -> Value:
546
- ...
477
+ def __lt__(self, other: Value) -> Value: ...
547
478
 
548
- def __truediv__(self, other: Value) -> Value:
549
- ...
479
+ def __truediv__(self, other: Value) -> Value: ...
550
480
 
551
- def astype(self, dtype: DType) -> Value:
552
- ...
481
+ def astype(self, dtype: DType) -> Value: ...
553
482
 
554
483
  # TODO: Add all operations
555
484
 
@@ -560,12 +489,10 @@ class Value(Expr):
560
489
  """
561
490
 
562
491
  @property
563
- def to_bool(self) -> Boolean:
564
- ...
492
+ def to_bool(self) -> Boolean: ...
565
493
 
566
494
  @property
567
- def to_int(self) -> Int:
568
- ...
495
+ def to_int(self) -> Int: ...
569
496
 
570
497
  @property
571
498
  def to_truthy_value(self) -> Value:
@@ -600,20 +527,15 @@ def _value(i: Int, f: Float, b: Boolean):
600
527
  class TupleValue(Expr):
601
528
  EMPTY: ClassVar[TupleValue]
602
529
 
603
- def __init__(self, head: Value) -> None:
604
- ...
530
+ def __init__(self, head: Value) -> None: ...
605
531
 
606
- def __add__(self, other: TupleValue) -> TupleValue:
607
- ...
532
+ def __add__(self, other: TupleValue) -> TupleValue: ...
608
533
 
609
- def length(self) -> Int:
610
- ...
534
+ def length(self) -> Int: ...
611
535
 
612
- def __getitem__(self, i: Int) -> Value:
613
- ...
536
+ def __getitem__(self, i: Int) -> Value: ...
614
537
 
615
- def includes(self, value: Value) -> Boolean:
616
- ...
538
+ def includes(self, value: Value) -> Boolean: ...
617
539
 
618
540
 
619
541
  converter(
@@ -661,41 +583,34 @@ def possible_values(values: Value) -> TupleValue:
661
583
 
662
584
 
663
585
  class NDArray(Expr):
664
- def __init__(self, py_array: PyObject) -> None:
665
- ...
586
+ def __init__(self, py_array: PyObject) -> None: ...
666
587
 
667
588
  @method(cost=200)
668
589
  @classmethod
669
- def var(cls, name: StringLike) -> NDArray:
670
- ...
590
+ def var(cls, name: StringLike) -> NDArray: ...
671
591
 
672
592
  @method(preserve=True)
673
593
  def __array_namespace__(self, api_version: object = None) -> ModuleType:
674
594
  return sys.modules[__name__]
675
595
 
676
596
  @property
677
- def ndim(self) -> Int:
678
- ...
597
+ def ndim(self) -> Int: ...
679
598
 
680
599
  @property
681
- def dtype(self) -> DType:
682
- ...
600
+ def dtype(self) -> DType: ...
683
601
 
684
602
  @property
685
- def device(self) -> Device:
686
- ...
603
+ def device(self) -> Device: ...
687
604
 
688
605
  @property
689
- def shape(self) -> TupleInt:
690
- ...
606
+ def shape(self) -> TupleInt: ...
691
607
 
692
608
  @method(preserve=True)
693
609
  def __bool__(self) -> bool:
694
610
  return bool(self.to_value().to_bool)
695
611
 
696
612
  @property
697
- def size(self) -> Int:
698
- ...
613
+ def size(self) -> Int: ...
699
614
 
700
615
  @method(preserve=True)
701
616
  def __len__(self) -> int:
@@ -706,17 +621,13 @@ class NDArray(Expr):
706
621
  for i in range(len(self)):
707
622
  yield self[IndexKey.int(Int(i))]
708
623
 
709
- def __getitem__(self, key: IndexKey) -> NDArray:
710
- ...
624
+ def __getitem__(self, key: IndexKey) -> NDArray: ...
711
625
 
712
- def __setitem__(self, key: IndexKey, value: NDArray) -> None:
713
- ...
626
+ def __setitem__(self, key: IndexKey, value: NDArray) -> None: ...
714
627
 
715
- def __lt__(self, other: NDArray) -> NDArray:
716
- ...
628
+ def __lt__(self, other: NDArray) -> NDArray: ...
717
629
 
718
- def __le__(self, other: NDArray) -> NDArray:
719
- ...
630
+ def __le__(self, other: NDArray) -> NDArray: ...
720
631
 
721
632
  def __eq__(self, other: NDArray) -> NDArray: # type: ignore[override]
722
633
  ...
@@ -725,109 +636,77 @@ class NDArray(Expr):
725
636
  # def __ne__(self, other: NDArray) -> NDArray: # type: ignore[override]
726
637
  # ...
727
638
 
728
- def __gt__(self, other: NDArray) -> NDArray:
729
- ...
639
+ def __gt__(self, other: NDArray) -> NDArray: ...
730
640
 
731
- def __ge__(self, other: NDArray) -> NDArray:
732
- ...
641
+ def __ge__(self, other: NDArray) -> NDArray: ...
733
642
 
734
- def __add__(self, other: NDArray) -> NDArray:
735
- ...
643
+ def __add__(self, other: NDArray) -> NDArray: ...
736
644
 
737
- def __sub__(self, other: NDArray) -> NDArray:
738
- ...
645
+ def __sub__(self, other: NDArray) -> NDArray: ...
739
646
 
740
- def __mul__(self, other: NDArray) -> NDArray:
741
- ...
647
+ def __mul__(self, other: NDArray) -> NDArray: ...
742
648
 
743
- def __matmul__(self, other: NDArray) -> NDArray:
744
- ...
649
+ def __matmul__(self, other: NDArray) -> NDArray: ...
745
650
 
746
- def __truediv__(self, other: NDArray) -> NDArray:
747
- ...
651
+ def __truediv__(self, other: NDArray) -> NDArray: ...
748
652
 
749
- def __floordiv__(self, other: NDArray) -> NDArray:
750
- ...
653
+ def __floordiv__(self, other: NDArray) -> NDArray: ...
751
654
 
752
- def __mod__(self, other: NDArray) -> NDArray:
753
- ...
655
+ def __mod__(self, other: NDArray) -> NDArray: ...
754
656
 
755
- def __divmod__(self, other: NDArray) -> NDArray:
756
- ...
657
+ def __divmod__(self, other: NDArray) -> NDArray: ...
757
658
 
758
- def __pow__(self, other: NDArray) -> NDArray:
759
- ...
659
+ def __pow__(self, other: NDArray) -> NDArray: ...
760
660
 
761
- def __lshift__(self, other: NDArray) -> NDArray:
762
- ...
661
+ def __lshift__(self, other: NDArray) -> NDArray: ...
763
662
 
764
- def __rshift__(self, other: NDArray) -> NDArray:
765
- ...
663
+ def __rshift__(self, other: NDArray) -> NDArray: ...
766
664
 
767
- def __and__(self, other: NDArray) -> NDArray:
768
- ...
665
+ def __and__(self, other: NDArray) -> NDArray: ...
769
666
 
770
- def __xor__(self, other: NDArray) -> NDArray:
771
- ...
667
+ def __xor__(self, other: NDArray) -> NDArray: ...
772
668
 
773
- def __or__(self, other: NDArray) -> NDArray:
774
- ...
669
+ def __or__(self, other: NDArray) -> NDArray: ...
775
670
 
776
- def __radd__(self, other: NDArray) -> NDArray:
777
- ...
671
+ def __radd__(self, other: NDArray) -> NDArray: ...
778
672
 
779
- def __rsub__(self, other: NDArray) -> NDArray:
780
- ...
673
+ def __rsub__(self, other: NDArray) -> NDArray: ...
781
674
 
782
- def __rmul__(self, other: NDArray) -> NDArray:
783
- ...
675
+ def __rmul__(self, other: NDArray) -> NDArray: ...
784
676
 
785
- def __rmatmul__(self, other: NDArray) -> NDArray:
786
- ...
677
+ def __rmatmul__(self, other: NDArray) -> NDArray: ...
787
678
 
788
- def __rtruediv__(self, other: NDArray) -> NDArray:
789
- ...
679
+ def __rtruediv__(self, other: NDArray) -> NDArray: ...
790
680
 
791
- def __rfloordiv__(self, other: NDArray) -> NDArray:
792
- ...
681
+ def __rfloordiv__(self, other: NDArray) -> NDArray: ...
793
682
 
794
- def __rmod__(self, other: NDArray) -> NDArray:
795
- ...
683
+ def __rmod__(self, other: NDArray) -> NDArray: ...
796
684
 
797
- def __rpow__(self, other: NDArray) -> NDArray:
798
- ...
685
+ def __rpow__(self, other: NDArray) -> NDArray: ...
799
686
 
800
- def __rlshift__(self, other: NDArray) -> NDArray:
801
- ...
687
+ def __rlshift__(self, other: NDArray) -> NDArray: ...
802
688
 
803
- def __rrshift__(self, other: NDArray) -> NDArray:
804
- ...
689
+ def __rrshift__(self, other: NDArray) -> NDArray: ...
805
690
 
806
- def __rand__(self, other: NDArray) -> NDArray:
807
- ...
691
+ def __rand__(self, other: NDArray) -> NDArray: ...
808
692
 
809
- def __rxor__(self, other: NDArray) -> NDArray:
810
- ...
693
+ def __rxor__(self, other: NDArray) -> NDArray: ...
811
694
 
812
- def __ror__(self, other: NDArray) -> NDArray:
813
- ...
695
+ def __ror__(self, other: NDArray) -> NDArray: ...
814
696
 
815
697
  @classmethod
816
- def scalar(cls, value: Value) -> NDArray:
817
- ...
698
+ def scalar(cls, value: Value) -> NDArray: ...
818
699
 
819
- def to_value(self) -> Value:
820
- ...
700
+ def to_value(self) -> Value: ...
821
701
 
822
702
  @property
823
- def T(self) -> NDArray: # noqa: N802
703
+ def T(self) -> NDArray:
824
704
  """
825
705
  https://data-apis.org/array-api/2022.12/API_specification/generated/array_api.array.T.html#array_api.array.T
826
706
  """
827
707
 
828
708
  @classmethod
829
- def vector(cls, values: TupleValue) -> NDArray:
830
- ...
709
+ def vector(cls, values: TupleValue) -> NDArray: ...
831
710
 
832
711
  def index(self, indices: TupleInt) -> Value:
833
712
  """
@@ -878,14 +757,11 @@ def _ndarray(x: NDArray, b: Boolean, f: Float, fi1: f64, fi2: f64):
878
757
  class TupleNDArray(Expr):
879
758
  EMPTY: ClassVar[TupleNDArray]
880
759
 
881
- def __init__(self, head: NDArray) -> None:
882
- ...
760
+ def __init__(self, head: NDArray) -> None: ...
883
761
 
884
- def __add__(self, other: TupleNDArray) -> TupleNDArray:
885
- ...
762
+ def __add__(self, other: TupleNDArray) -> TupleNDArray: ...
886
763
 
887
- def length(self) -> Int:
888
- ...
764
+ def length(self) -> Int: ...
889
765
 
890
766
  @method(preserve=True)
891
767
  def __len__(self) -> int:
@@ -895,8 +771,7 @@ class TupleNDArray(Expr):
895
771
  def __iter__(self) -> Iterator[NDArray]:
896
772
  return iter(self[Int(i)] for i in range(len(self)))
897
773
 
898
- def __getitem__(self, i: Int) -> NDArray:
899
- ...
774
+ def __getitem__(self, i: Int) -> NDArray: ...
900
775
 
901
776
 
902
777
  converter(
@@ -928,8 +803,7 @@ class OptionalBool(Expr):
928
803
  none: ClassVar[OptionalBool]
929
804
 
930
805
  @classmethod
931
- def some(cls, value: Boolean) -> OptionalBool:
932
- ...
806
+ def some(cls, value: Boolean) -> OptionalBool: ...
933
807
 
934
808
 
935
809
  converter(type(None), OptionalBool, lambda _: OptionalBool.none)
@@ -940,8 +814,7 @@ class OptionalDType(Expr):
940
814
  none: ClassVar[OptionalDType]
941
815
 
942
816
  @classmethod
943
- def some(cls, value: DType) -> OptionalDType:
944
- ...
817
+ def some(cls, value: DType) -> OptionalDType: ...
945
818
 
946
819
 
947
820
  converter(type(None), OptionalDType, lambda _: OptionalDType.none)
@@ -952,8 +825,7 @@ class OptionalDevice(Expr):
952
825
  none: ClassVar[OptionalDevice]
953
826
 
954
827
  @classmethod
955
- def some(cls, value: Device) -> OptionalDevice:
956
- ...
828
+ def some(cls, value: Device) -> OptionalDevice: ...
957
829
 
958
830
 
959
831
  converter(type(None), OptionalDevice, lambda _: OptionalDevice.none)
@@ -964,8 +836,7 @@ class OptionalTupleInt(Expr):
964
836
  none: ClassVar[OptionalTupleInt]
965
837
 
966
838
  @classmethod
967
- def some(cls, value: TupleInt) -> OptionalTupleInt:
968
- ...
839
+ def some(cls, value: TupleInt) -> OptionalTupleInt: ...
969
840
 
970
841
 
971
842
  converter(type(None), OptionalTupleInt, lambda _: OptionalTupleInt.none)
@@ -976,12 +847,10 @@ class IntOrTuple(Expr):
976
847
  none: ClassVar[IntOrTuple]
977
848
 
978
849
  @classmethod
979
- def int(cls, value: Int) -> IntOrTuple:
980
- ...
850
+ def int(cls, value: Int) -> IntOrTuple: ...
981
851
 
982
852
  @classmethod
983
- def tuple(cls, value: TupleInt) -> IntOrTuple:
984
- ...
853
+ def tuple(cls, value: TupleInt) -> IntOrTuple: ...
985
854
 
986
855
 
987
856
  converter(Int, IntOrTuple, IntOrTuple.int)
@@ -992,8 +861,7 @@ class OptionalIntOrTuple(Expr):
992
861
  none: ClassVar[OptionalIntOrTuple]
993
862
 
994
863
  @classmethod
995
- def some(cls, value: IntOrTuple) -> OptionalIntOrTuple:
996
- ...
864
+ def some(cls, value: IntOrTuple) -> OptionalIntOrTuple: ...
997
865
 
998
866
 
999
867
  converter(type(None), OptionalIntOrTuple, lambda _: OptionalIntOrTuple.none)
@@ -1001,8 +869,9 @@ converter(IntOrTuple, OptionalIntOrTuple, OptionalIntOrTuple.some)
1001
869
 
1002
870
 
1003
871
  @function
1004
- def asarray(a: NDArray, dtype: OptionalDType = OptionalDType.none, copy: OptionalBool = OptionalBool.none) -> NDArray:
1005
- ...
872
+ def asarray(
873
+ a: NDArray, dtype: OptionalDType = OptionalDType.none, copy: OptionalBool = OptionalBool.none
874
+ ) -> NDArray: ...
1006
875
 
1007
876
 
1008
877
  @array_api_ruleset.register
@@ -1012,8 +881,7 @@ def _assarray(a: NDArray, d: OptionalDType, ob: OptionalBool):
1012
881
 
1013
882
 
1014
883
  @function
1015
- def isfinite(x: NDArray) -> NDArray:
1016
- ...
884
+ def isfinite(x: NDArray) -> NDArray: ...
1017
885
 
1018
886
 
1019
887
  @function
@@ -1032,8 +900,7 @@ def _sum(x: NDArray, y: NDArray, v: Value, dtype: DType):
1032
900
 
1033
901
 
1034
902
  @function
1035
- def reshape(x: NDArray, shape: TupleInt, copy: OptionalBool = OptionalBool.none) -> NDArray:
1036
- ...
903
+ def reshape(x: NDArray, shape: TupleInt, copy: OptionalBool = OptionalBool.none) -> NDArray: ...
1037
904
 
1038
905
 
1039
906
  # @function
@@ -1075,8 +942,7 @@ def reshape(x: NDArray, shape: TupleInt, copy: OptionalBool = OptionalBool.none)
1075
942
 
1076
943
 
1077
944
  @function
1078
- def unique_values(x: NDArray) -> NDArray:
1079
- ...
945
+ def unique_values(x: NDArray) -> NDArray: ...
1080
946
 
1081
947
 
1082
948
  @array_api_ruleset.register
@@ -1087,8 +953,7 @@ def _unique_values(x: NDArray):
1087
953
 
1088
954
 
1089
955
  @function
1090
- def concat(arrays: TupleNDArray, axis: OptionalInt = OptionalInt.none) -> NDArray:
1091
- ...
956
+ def concat(arrays: TupleNDArray, axis: OptionalInt = OptionalInt.none) -> NDArray: ...
1092
957
 
1093
958
 
1094
959
  @array_api_ruleset.register
@@ -1099,8 +964,7 @@ def _concat(x: NDArray):
1099
964
 
1100
965
 
1101
966
  @function
1102
- def astype(x: NDArray, dtype: DType) -> NDArray:
1103
- ...
967
+ def astype(x: NDArray, dtype: DType) -> NDArray: ...
1104
968
 
1105
969
 
1106
970
  @array_api_ruleset.register
@@ -1113,9 +977,8 @@ def _astype(x: NDArray, dtype: DType, i: i64):
1113
977
  ]
1114
978
 
1115
979
 
1116
- @function(cost=500)
1117
- def unique_counts(x: NDArray) -> TupleNDArray:
1118
- ...
980
+ @function
981
+ def unique_counts(x: NDArray) -> TupleNDArray: ...
1119
982
 
1120
983
 
1121
984
  @array_api_ruleset.register
@@ -1131,23 +994,19 @@ def _unique_counts(x: NDArray, c: NDArray, tv: TupleValue, v: Value, dtype: DTyp
1131
994
 
1132
995
 
1133
996
  @function
1134
- def square(x: NDArray) -> NDArray:
1135
- ...
997
+ def square(x: NDArray) -> NDArray: ...
1136
998
 
1137
999
 
1138
1000
  @function
1139
- def any(x: NDArray) -> NDArray:
1140
- ...
1001
+ def any(x: NDArray) -> NDArray: ...
1141
1002
 
1142
1003
 
1143
1004
  @function(egg_fn="ndarray-abs")
1144
- def abs(x: NDArray) -> NDArray:
1145
- ...
1005
+ def abs(x: NDArray) -> NDArray: ...
1146
1006
 
1147
1007
 
1148
1008
  @function(egg_fn="ndarray-log")
1149
- def log(x: NDArray) -> NDArray:
1150
- ...
1009
+ def log(x: NDArray) -> NDArray: ...
1151
1010
 
1152
1011
 
1153
1012
  @array_api_ruleset.register
@@ -1157,9 +1016,8 @@ def _abs(f: Float):
1157
1016
  ]
1158
1017
 
1159
1018
 
1160
- @function(cost=100)
1161
- def unique_inverse(x: NDArray) -> TupleNDArray:
1162
- ...
1019
+ @function
1020
+ def unique_inverse(x: NDArray) -> TupleNDArray: ...
1163
1021
 
1164
1022
 
1165
1023
  @array_api_ruleset.register
@@ -1174,29 +1032,24 @@ def _unique_inverse(x: NDArray, i: Int):
1174
1032
  @function
1175
1033
  def zeros(
1176
1034
  shape: TupleInt, dtype: OptionalDType = OptionalDType.none, device: OptionalDevice = OptionalDevice.none
1177
- ) -> NDArray:
1178
- ...
1035
+ ) -> NDArray: ...
1179
1036
 
1180
1037
 
1181
1038
  @function
1182
- def expand_dims(x: NDArray, axis: Int = Int(0)) -> NDArray:
1183
- ...
1039
+ def expand_dims(x: NDArray, axis: Int = Int(0)) -> NDArray: ...
1184
1040
 
1185
1041
 
1186
- @function(cost=100000)
1187
- def mean(x: NDArray, axis: OptionalIntOrTuple = OptionalIntOrTuple.none, keepdims: Boolean = FALSE) -> NDArray:
1188
- ...
1042
+ @function
1043
+ def mean(x: NDArray, axis: OptionalIntOrTuple = OptionalIntOrTuple.none, keepdims: Boolean = FALSE) -> NDArray: ...
1189
1044
 
1190
1045
 
1191
1046
  # TODO: Possibly change names to include modules.
1192
1047
  @function(egg_fn="ndarray-sqrt")
1193
- def sqrt(x: NDArray) -> NDArray:
1194
- ...
1048
+ def sqrt(x: NDArray) -> NDArray: ...
1195
1049
 
1196
1050
 
1197
- @function(cost=100000)
1198
- def std(x: NDArray, axis: OptionalIntOrTuple = OptionalIntOrTuple.none) -> NDArray:
1199
- ...
1051
+ @function
1052
+ def std(x: NDArray, axis: OptionalIntOrTuple = OptionalIntOrTuple.none) -> NDArray: ...
1200
1053
 
1201
1054
 
1202
1055
  linalg = sys.modules[__name__]
@@ -1485,13 +1338,11 @@ def _size(x: NDArray):
1485
1338
 
1486
1339
 
1487
1340
  @overload
1488
- def try_evaling(expr: Expr, prim_expr: i64) -> int:
1489
- ...
1341
+ def try_evaling(expr: Expr, prim_expr: i64) -> int: ...
1490
1342
 
1491
1343
 
1492
1344
  @overload
1493
- def try_evaling(expr: Expr, prim_expr: Bool) -> bool:
1494
- ...
1345
+ def try_evaling(expr: Expr, prim_expr: Bool) -> bool: ...
1495
1346
 
1496
1347
 
1497
1348
  def try_evaling(expr: Expr, prim_expr: i64 | Bool) -> int | bool: