failed test case when init jit with empty inputs (#13641)

not related to bert grad acc, but still seems to be a bug
This commit is contained in:
chenyu
2025-12-10 22:03:06 -05:00
committed by GitHub
parent 51f3c9f615
commit 03600aef1e

View File

@@ -501,6 +501,18 @@ class TestJit(unittest.TestCase):
b = f(Tensor([2.0]))
assert abs((a - b).item()) > 0.5
def test_jit_init_with_empty_different_size(self):
@TinyJit
def f(x:Tensor) -> Tensor: return (x + 1).realize()
f(Tensor.empty(1))
f(Tensor.empty(1))
# TODO: this should fail since input has a different size
f(Tensor(2.0)).item()
# TODO: this should not fail, and should return 3
with self.assertRaises(AssertionError):
f(Tensor([2.0])).item()
@unittest.skip("Pending multioutput implementation #3607")
class TestMultioutputJit(unittest.TestCase):
def _test(self, f):