rangeify: late zero folding (#12464)

* rangeify: late zero folding

* early

* not kernels

* none

* multi

* linter

* mstack is sink comment

* more comment
This commit is contained in:
qazal
2025-10-06 12:52:33 +03:00
committed by GitHub
parent 0c015a24fe
commit 76e8a3250c
3 changed files with 15 additions and 7 deletions

View File

@@ -814,6 +814,14 @@ class TestSchedule(unittest.TestCase):
check_schedule(a, 0)
self.assertEqual(a.tolist(), [])
def test_zero_size_children(self):
r = Tensor.ones(1,2).contiguous().realize().sum(axis=(1,), keepdim=True)
ax = r.reshape(1)*2
ay = r.reshape(1).shrink(((1,1),))*2
out = ax+ay.pad(((1, 0),))
run_schedule(check_schedule(out, 1))
self.assertEqual(out.item(), 4.)
def test_reduce_permute_nofuse(self):
x = Tensor.empty(32, 32, 32)
y = Tensor.empty(32, 32)