From 17ecaf4682fa3bf5960bd5291d5fa27e4af29c0b Mon Sep 17 00:00:00 2001 From: Ben Waldron <140399313+ben-waldron-1@users.noreply.github.com> Date: Thu, 28 Aug 2025 15:38:27 +0000 Subject: [PATCH] Add test_variable_empty (#11889) * Add test_variable_empty * Move test and add TODO --------- Co-authored-by: chenyu --- test/test_tensor_variable.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/test_tensor_variable.py b/test/test_tensor_variable.py index a680cf9a6e..85ef0c5104 100644 --- a/test/test_tensor_variable.py +++ b/test/test_tensor_variable.py @@ -92,5 +92,15 @@ class TestTensorVariable(unittest.TestCase): ret = Tensor.arange(begin.bind(4), end.bind(7)) self.assertListEqual(ret.reshape(3).tolist(), [4,5,6]) + def test_variable_empty(self): + v = Variable("i", 1, 10) + # TODO: Tensor creation from unbound variable should assert + # with self.assertRaises(AssertionError): t = Tensor.empty(3, v) + vb = v.bind(3) + t = Tensor.empty(3, vb) + assert t.uop.base.buffer.size == 30 + assert t.uop.st.shape == (3, vb) + + if __name__ == '__main__': unittest.main()