Skip to content

Commit 6b746d6

Browse files
committed
update new tests
1 parent 0c721a5 commit 6b746d6

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

dpnp/tests/test_linalg.py

+7-6
Original file line numberDiff line numberDiff line change
@@ -175,14 +175,15 @@ def test_cholesky(self, array, dtype):
175175
)
176176
@pytest.mark.parametrize("dtype", get_all_dtypes(no_bool=True))
177177
def test_cholesky_upper(self, array, dtype):
178-
ia = dpnp.array(array, dtype=dtype)
178+
a = numpy.array(array, dtype=dtype)
179+
ia = dpnp.array(a)
179180
result = dpnp.linalg.cholesky(ia, upper=True)
180181

181-
if ia.ndim > 2:
182+
if a.ndim > 2:
182183
n = ia.shape[-1]
183-
ia_reshaped = ia.reshape(-1, n, n)
184+
a_reshaped = a.reshape(-1, n, n)
184185
res_reshaped = result.reshape(-1, n, n)
185-
batch_size = ia_reshaped.shape[0]
186+
batch_size = a_reshaped.shape[0]
186187
for idx in range(batch_size):
187188
# Reconstruct the matrix using the Cholesky decomposition result
188189
if dpnp.issubdtype(dtype, dpnp.complexfloating):
@@ -192,15 +193,15 @@ def test_cholesky_upper(self, array, dtype):
192193
else:
193194
reconstructed = res_reshaped[idx].T @ res_reshaped[idx]
194195
assert_dtype_allclose(
195-
reconstructed, ia_reshaped[idx], check_type=False
196+
reconstructed, a_reshaped[idx], check_type=False
196197
)
197198
else:
198199
# Reconstruct the matrix using the Cholesky decomposition result
199200
if dpnp.issubdtype(dtype, dpnp.complexfloating):
200201
reconstructed = result.T.conj() @ result
201202
else:
202203
reconstructed = result.T @ result
203-
assert_dtype_allclose(reconstructed, ia, check_type=False)
204+
assert_dtype_allclose(reconstructed, a, check_type=False)
204205

205206
# upper parameter support will be added in numpy 2.0 version
206207
@testing.with_requires("numpy>=2.0")

dpnp/tests/test_mathematical.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -2363,13 +2363,13 @@ def test_projection_infinity(self, dtype):
23632363
a = dpnp.array(X, dtype=dtype)
23642364
result = dpnp.proj(a)
23652365
expected = dpnp.array(Y, dtype=dtype)
2366-
assert_dtype_allclose(result, expected)
2366+
assert_array_equal(result, expected)
23672367

23682368
# out keyword
23692369
dp_out = dpnp.empty(expected.shape, dtype=expected.dtype)
23702370
result = dpnp.proj(a, out=dp_out)
23712371
assert dp_out is result
2372-
assert_dtype_allclose(result, expected)
2372+
assert_array_equal(result, expected)
23732373

23742374
@pytest.mark.parametrize("dtype", get_all_dtypes())
23752375
def test_projection(self, dtype):
@@ -3660,4 +3660,4 @@ def test_elemenwise_outer_scalar():
36603660
y = dpnp.asarray(s)
36613661
expected = dpnp.add.outer(x, y)
36623662
result = dpnp.add.outer(x, s)
3663-
assert_dtype_allclose(result, expected)
3663+
assert_array_equal(result, expected)

0 commit comments

Comments
 (0)