mirror of
https://github.com/tinygrad/tinygrad.git
synced 2026-01-10 07:28:15 -05:00
fix view_left for unsafe pad ops [pr] (#9478)
This commit is contained in:
@@ -1971,6 +1971,16 @@ class TestSwizzle(unittest.TestCase):
|
||||
t = a_reduce+b_reduce
|
||||
with Context(DONT_GROUP_REDUCES=1, DONT_REALIZE_EXPAND=1): run_schedule(check_schedule(t, 1))
|
||||
|
||||
def test_unsafe_pad(self):
|
||||
x = Tensor.full((2,2), 1.0).contiguous()
|
||||
y = x*x.sum((1,)).reciprocal()
|
||||
t = y.pad(((0,1),None)).contiguous()
|
||||
swizzled = swizzle_rewrite(t.lazydata)
|
||||
sched = check_schedule(swizzled.sink(), 3)
|
||||
output_buffer = sched[-1].bufs[0]
|
||||
run_schedule(sched)
|
||||
self.assertListEqual(output_buffer.as_buffer().cast("f").tolist(), [0.5, 0.5, 0.5, 0.5, 0., 0.])
|
||||
|
||||
def store_val(si:ScheduleItem): return si.ast.src[0].src[2]
|
||||
zero_pm = UPat(Ops.CONST, arg=0)
|
||||
class TestView(unittest.TestCase):
|
||||
|
||||
Reference in New Issue
Block a user