From bdb3afd5662acab94518390d40c4ce64f3f9d3e3 Mon Sep 17 00:00:00 2001 From: chenyu Date: Mon, 15 Sep 2025 00:25:21 -0400 Subject: [PATCH] failed test case for symbolic pad (#12179) --- test/test_symbolic_jit.py | 12 ++++++++++++ test/test_symbolic_ops.py | 9 +++++++++ 2 files changed, 21 insertions(+) diff --git a/test/test_symbolic_jit.py b/test/test_symbolic_jit.py index fe819e6791..f8dfbdfc31 100644 --- a/test/test_symbolic_jit.py +++ b/test/test_symbolic_jit.py @@ -16,6 +16,18 @@ class TestSymbolicJit(unittest.TestCase): np.testing.assert_allclose(symbolic, expected, atol=1e-6, rtol=1e-6) assert_jit_cache_len(jf, 1) + @unittest.expectedFailure # TODO: fix, this works without jit + def test_plus1_pad(self): + def f(a): return (a+1).pad((None, (0, 10-a.shape[1]))).realize() + jf = TinyJit(f) + a = Tensor.rand(3, 10) + for i in range(1, 5): + vi = Variable("i", 1, 10).bind(i) + symbolic = jf(a[:, :vi]).numpy() + expected = f(a[:, :i]).numpy() + np.testing.assert_allclose(symbolic, expected, atol=1e-6, rtol=1e-6) + assert_jit_cache_len(jf, 1) + def test_add(self): def f(a, b): return (a+b).realize() jf = TinyJit(f) diff --git a/test/test_symbolic_ops.py b/test/test_symbolic_ops.py index 2c2cbebdd3..885953891c 100644 --- a/test/test_symbolic_ops.py +++ b/test/test_symbolic_ops.py @@ -17,6 +17,15 @@ class TestSymbolicOps(unittest.TestCase): expected = f(a[:, :i]).numpy() np.testing.assert_allclose(symbolic, expected, atol=1e-6, rtol=1e-6) + def test_plus1_pad(self): + def f(a): return (a+1).pad((None, (0, 10-a.shape[1]))).realize() + a = Tensor.rand(3, 10) + for i in range(1, 5): + vi = Variable("i", 1, 10).bind(i) + symbolic = f(a[:, :vi]).numpy() + expected = f(a[:, :i]).numpy() + np.testing.assert_allclose(symbolic, expected, atol=1e-6, rtol=1e-6) + def test_add(self): def f(a, b): return (a+b).realize() a = Tensor.rand(3, 10)