(self)
| 1034 | class TestUOpBecome(unittest.TestCase): |
| 1035 | # the simplest case, if we create a new BUFFER for this tensor UOp |
| 1036 | def test_new_buffer(self): |
| 1037 | a = Tensor.empty(4, 4) |
| 1038 | b = Tensor.empty(4, 4) |
| 1039 | add = a+b |
| 1040 | check_schedule(add, 1) |
| 1041 | # NOTE: realized base is always a flat buffer |
| 1042 | assert UPat(Ops.BUFFER).match(add.uop.base, {}) |
| 1043 | # the Tensor UOp can optionally stack a VIEW on top of the BUFFER, in this case to preserve the (4, 4) shape of the tensor |
| 1044 | assert add.uop is not add.uop.base |
| 1045 | self.assertEqual(add.uop.numel(), 16) |
| 1046 | self.assertEqual(add.uop.shape, (4, 4)) |
| 1047 | |
| 1048 | def test_new_buffer_view(self): |
| 1049 | a = Tensor.empty(4, 4) |
nothing calls this directly
no test coverage detected