From 13829e557d1d67925b6e9db6874404a7a03fd1db Mon Sep 17 00:00:00 2001 From: Samuel Ainsworth Date: Sun, 5 Jan 2025 11:43:19 -0500 Subject: [PATCH] tests/test_core.py: fix failing test --- tests/test_core.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/test_core.py b/tests/test_core.py index 3f215a2..a411150 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -15,9 +15,10 @@ def test_arange(): def test_empty(): - t2j_function_test(lambda: torch.empty(()), []) - t2j_function_test(lambda: torch.empty(2), []) - t2j_function_test(lambda: torch.empty((2, 3)), []) + # torch.empty returns uninitialized values, so we need to multiply by 0 for deterministic, testable behavior. + t2j_function_test(lambda: 0 * torch.empty(()), []) + t2j_function_test(lambda: 0 * torch.empty(2), []) + t2j_function_test(lambda: 0 * torch.empty((2, 3)), []) def test_ones():