remove the "no copy" line from copy_to_device (#8702)

* delete the no copy one

* add tests
This commit is contained in:
qazal
2025-01-21 10:09:33 -05:00
committed by GitHub
parent 3628f89929
commit d6bf1feaab
2 changed files with 11 additions and 2 deletions

View File

@@ -2258,6 +2258,17 @@ class TestCopyFolding(unittest.TestCase):
add = schedule_graph_rewrite(add)
assert all_same([x.device for x in add.src]), f"ALU has different devices! {[x.device for x in add.src]}"
def test_copy_to_same_device(self):
a = Tensor.empty(4).lazydata
b = a.copy_to_device(a.device)
check_schedule(b, 0, filter_sink=False)
b = schedule_graph_rewrite(b)
self.assertIs(b, a)
def test_clone(self):
a = Tensor.empty(4).lazydata
check_schedule(a.clone(), 1, filter_sink=False)
class TestTensorUOpSpec(unittest.TestCase):
def test_const_must_be_unmasked(self):
a = Tensor.ones((4, 4)).pad((2, 2))