Commit 9700b94
committed
Fixed several issues with tensor.arange found during integration with dpnp
dpt.arange(0, stop=10, step=None) raised, works in numpy
dpt.arange(9.7, stop=10) gave empty array, gives 1 element array in numpy
dpt.arange(0,stop=2, dtype='bool') raised, works in numpy
First two were just bugs, and got fixed.
The last one now works through special-casing bools. It works by
constructing int8 temporary and casting it into bool array only if
the resulting sequence has length 0, 1, or 2.
Aligned with behavior of np.arange in computation of the step.
To this end changed the logic of determining
step argument for the call to `_linspace_step` routine. We now
compute first and second element of the array of given type, and
determine the step as a the difference of these.
To avoid possible overflow message when subtracting unsigned integers,
cast first and second element to int64, subtract, and cast to the
target type.1 parent 59980a2 commit 9700b94
1 file changed
+37
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
483 | 483 | | |
484 | 484 | | |
485 | 485 | | |
486 | | - | |
| 486 | + | |
487 | 487 | | |
488 | 488 | | |
489 | 489 | | |
490 | 490 | | |
491 | 491 | | |
492 | 492 | | |
493 | 493 | | |
494 | | - | |
| 494 | + | |
495 | 495 | | |
496 | 496 | | |
497 | | - | |
| 497 | + | |
| 498 | + | |
498 | 499 | | |
499 | 500 | | |
500 | | - | |
| 501 | + | |
501 | 502 | | |
502 | 503 | | |
503 | 504 | | |
| |||
536 | 537 | | |
537 | 538 | | |
538 | 539 | | |
| 540 | + | |
| 541 | + | |
539 | 542 | | |
540 | 543 | | |
541 | | - | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
542 | 548 | | |
543 | 549 | | |
544 | 550 | | |
545 | | - | |
| 551 | + | |
546 | 552 | | |
547 | 553 | | |
548 | 554 | | |
| |||
554 | 560 | | |
555 | 561 | | |
556 | 562 | | |
| 563 | + | |
| 564 | + | |
557 | 565 | | |
558 | 566 | | |
559 | 567 | | |
560 | 568 | | |
561 | 569 | | |
562 | 570 | | |
563 | 571 | | |
564 | | - | |
565 | | - | |
566 | | - | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
567 | 585 | | |
568 | 586 | | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
569 | 597 | | |
570 | 598 | | |
571 | 599 | | |
| |||
0 commit comments