mirror of
https://github.com/tinygrad/tinygrad.git
synced 2026-04-07 03:00:26 -04:00
Tensor.empty is RESHAPE(BUFFER) (#8987)
* empty is RESHAPE(BUFFER)
* eh
* add test_empty_buf
* can we unsupport this
* linter
* Revert "can we unsupport this"
This reverts commit 0f71e1aadb.
This commit is contained in:
@@ -2151,9 +2151,9 @@ class TestBigGraph(unittest.TestCase):
|
||||
a = Tensor.empty(4, 4, dtype=dtypes.int)
|
||||
sink = tensor_rewrite(a*0)
|
||||
assert UPat(Ops.CONST, arg=0).match(sink, {})
|
||||
self.assertIs(tensor_rewrite(a*1), a.lazydata)
|
||||
self.assertIs(tensor_rewrite(a+0), a.lazydata)
|
||||
self.assertIs(tensor_rewrite(a//1), a.lazydata)
|
||||
self.assertIs(tensor_rewrite(a*1).base, a.lazydata.base)
|
||||
self.assertIs(tensor_rewrite(a+0).base, a.lazydata.base)
|
||||
self.assertIs(tensor_rewrite(a//1).base, a.lazydata.base)
|
||||
|
||||
def test_cast_folding(self):
|
||||
a = Tensor(1.0).cast(dtypes.int)
|
||||
@@ -2310,7 +2310,7 @@ class TestCopyFolding(unittest.TestCase):
|
||||
b = a.copy_to_device(a.device)
|
||||
check_schedule(b, 0, filter_sink=False)
|
||||
b = schedule_graph_rewrite(b)
|
||||
self.assertIs(b, a)
|
||||
self.assertIs(b.base, a.base)
|
||||
|
||||
def test_clone(self):
|
||||
a = Tensor.empty(4).lazydata
|
||||
|
||||
Reference in New Issue
Block a user