Arange overflow raises error and one_hot upcast (#11975)

* add error

* to_dtype

* shorten line

* add test

* upcast one hot dim im overflows
This commit is contained in:
Sieds Lykles
2025-09-13 00:18:25 +02:00
committed by GitHub
parent aac3dceaf6
commit 2fc0bd150b
2 changed files with 8 additions and 2 deletions

View File

@@ -918,6 +918,10 @@ class TestIdxUpcast(unittest.TestCase):
uops = self._schedule_render(a)
assert all(uop.dtype is not dtypes.long for uop in uops)
def test_arange_raise_overflow(self):
with self.assertRaises(ValueError):
self._schedule_render(Tensor.arange(2**33, dtype=dtypes.int))
@unittest.skipIf(is_dtype_supported(dtypes.long), "int64 is supported")
def test_int64_unsupported_overflow_sym(self):
with self.assertRaises(KeyError):