Skip to content

Commit 1855c77

Browse files
committed
Address review comments by @mtsokol.
1 parent 0577a73 commit 1855c77

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

sparse/mlir_backend/_ops.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,9 @@ def add(x1: Array, x2: Array, /) -> Array:
181181

182182

183183
def asformat(x: Array, /, format: StorageFormat) -> Array:
184+
if x.format == format:
185+
return x
186+
184187
out_tensor_type = format._get_mlir_type(shape=x.shape)
185188
ret_storage = format._get_ctypes_type(owns_memory=True)()
186189

sparse/mlir_backend/tests/test_simple.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -416,9 +416,12 @@ def test_reshape_dense(dtype):
416416
np.testing.assert_equal(actual_np, expected)
417417

418418

419-
@pytest.mark.skip(reason="Segfault")
420-
@pytest.mark.parametrize("src_fmt", ["csr", "csc"])
421-
@pytest.mark.parametrize("dst_fmt", ["csr", "csc"])
419+
@pytest.mark.parametrize(
420+
"src_fmt", ["csr", "csc", pytest.param("coo", marks=pytest.mark.skip(reason="TODO: Report MLIR issue"))]
421+
)
422+
@pytest.mark.parametrize(
423+
"dst_fmt", ["csr", "csc", pytest.param("coo", marks=pytest.mark.skip(reason="TODO: Report MLIR issue"))]
424+
)
422425
def test_asformat(rng, src_fmt, dst_fmt):
423426
SHAPE = (100, 50)
424427
DENSITY = 0.5

0 commit comments

Comments
 (0)