Commit 5a338ad
[torchlib] Fix linspace implementation for int64 (#2693)
## Description
Fixes #854 - linspace now correctly handles int64 dtype
## Changes
- Modified `aten_linspace` to compute in floating-point then cast to
target dtype
- This matches PyTorch's behavior and fixes integer division precision
loss
## Testing
Manually verified: `linspace(0, 10, 5, dtype=int64)` now produces
correct output `[0, 2, 5, 7, 10]`
## Questions
Where should I add automated test cases for this fix? Happy to add tests
wherever you suggest!
---------
Co-authored-by: Ti-Tai Wang <[email protected]>
Co-authored-by: Justin Chu <[email protected]>1 parent 565b8e5 commit 5a338ad
File tree
2 files changed
+35
-24
lines changed- onnxscript/function_libs/torch_lib/ops
- tests/function_libs/torch_lib
2 files changed
+35
-24
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5494 | 5494 | | |
5495 | 5495 | | |
5496 | 5496 | | |
5497 | | - | |
5498 | | - | |
| 5497 | + | |
| 5498 | + | |
5499 | 5499 | | |
5500 | | - | |
| 5500 | + | |
5501 | 5501 | | |
5502 | 5502 | | |
5503 | 5503 | | |
| |||
5507 | 5507 | | |
5508 | 5508 | | |
5509 | 5509 | | |
5510 | | - | |
5511 | 5510 | | |
5512 | 5511 | | |
5513 | 5512 | | |
5514 | 5513 | | |
5515 | 5514 | | |
5516 | | - | |
5517 | | - | |
5518 | | - | |
5519 | | - | |
5520 | | - | |
5521 | | - | |
5522 | | - | |
5523 | | - | |
5524 | | - | |
5525 | | - | |
5526 | | - | |
5527 | | - | |
| 5515 | + | |
| 5516 | + | |
| 5517 | + | |
| 5518 | + | |
| 5519 | + | |
| 5520 | + | |
| 5521 | + | |
| 5522 | + | |
| 5523 | + | |
| 5524 | + | |
| 5525 | + | |
| 5526 | + | |
| 5527 | + | |
| 5528 | + | |
| 5529 | + | |
| 5530 | + | |
| 5531 | + | |
| 5532 | + | |
| 5533 | + | |
| 5534 | + | |
| 5535 | + | |
| 5536 | + | |
| 5537 | + | |
| 5538 | + | |
| 5539 | + | |
| 5540 | + | |
| 5541 | + | |
| 5542 | + | |
| 5543 | + | |
| 5544 | + | |
5528 | 5545 | | |
5529 | 5546 | | |
| 5547 | + | |
| 5548 | + | |
5530 | 5549 | | |
5531 | 5550 | | |
5532 | 5551 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
779 | 779 | | |
780 | 780 | | |
781 | 781 | | |
782 | | - | |
783 | | - | |
784 | | - | |
785 | | - | |
786 | | - | |
787 | | - | |
788 | | - | |
789 | | - | |
790 | 782 | | |
791 | 783 | | |
792 | 784 | | |
| |||
0 commit comments