Skip to content

Commit

Permalink
tests/test_core.py: fix failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
samuela committed Jan 5, 2025
1 parent 6faa450 commit 13829e5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down

0 comments on commit 13829e5

Please sign in to comment.