From 4fef89c04894d7358dc6cf5623f09d0188e5c9f3 Mon Sep 17 00:00:00 2001 From: Aaron Meurer Date: Wed, 6 Mar 2024 17:00:25 -0700 Subject: [PATCH] Avoid using .size in test_eye .size doesn't work in pytorch and cannot be worked around even in the compat library. --- array_api_tests/test_creation_functions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/array_api_tests/test_creation_functions.py b/array_api_tests/test_creation_functions.py index ec2df060..7df439f5 100644 --- a/array_api_tests/test_creation_functions.py +++ b/array_api_tests/test_creation_functions.py @@ -359,7 +359,7 @@ def test_eye(n_rows, n_cols, kw): [[1 if j - i == k else 0 for j in range(_n_cols)] for i in range(n_rows)], dtype=out.dtype # Note: dtype already checked above. ) - if expected.size == 0: + if 0 in expected.shape: expected = xp.reshape(expected, (n_rows, _n_cols)) ph.assert_array_elements("eye", out=out, expected=expected, kw=kw)