def test_inplace_csr_row_normalize_l2(failure_logger, sparse_random_dataset): X_np, _, _, X_sparse = sparse_random_dataset if X_sparse.format != 'csr': pytest.skip('Skip non CSR matrices') inplace_csr_row_normalize_l2(X_sparse) X_np = sk_normalize(X_np, norm='l2', axis=1) assert_allclose(X_sparse, X_np)
def test_inplace_csr_row_normalize_l2(sparse_clf_dataset): # noqa: F811 X_np, X = sparse_clf_dataset if not cp.sparse.issparse(X): pytest.skip("Skipping non-CuPy or non-sparse arrays") if X.format != 'csr': X = X.tocsr() inplace_csr_row_normalize_l2(X) X_np = X_np.toarray() X_np = sk_normalize(X_np, norm='l2', axis=1) assert_allclose(X, X_np)