Skip to content

Sparse matrix (cupyx.scipy.sparse.csr_matrix) attribute 'device' shows not implemented error #9491

@ninoyrahman

Description

@ninoyrahman

Description

When the 'device' attribute for the sparse matrix cupyx.scipy.sparse.csr_matrix is called, NotImplementedError is shown.

To Reproduce

# Write the code here

import cupy as cp
import cupyx.scipy as cps

row = cp.array([0, 0, 1, 2, 2, 2], dtype=cp.int32)
col = cp.array([0, 2, 2, 0, 1, 2], dtype=cp.int32)
data = cp.array([1, 2, 3, 4, 5, 6], dtype=cp.float32)
A = cps.sparse.csr_matrix((data, (row, col)), dtype=cp.float32)
print(A.device)

Installation

Wheel (`pip install cupy-cuda12x)

Environment

# Paste the output here

NotImplementedError Traceback (most recent call last)
Cell In[8], line 8
6 data = cp.array([1, 2, 3, 4, 5, 6], dtype=cp.float32)
7 A = cps.sparse.csr_matrix((data, (row, col)), dtype=cp.float32)
----> 8 print(A.device)

File ~\AppData\Local\Programs\Python\Python311\Lib\site-packages\cupyx\scipy\sparse_base.py:42, in spmatrix.device(self)
39 @Property
40 def device(self):
41 """CUDA device on which this array resides."""
---> 42 raise NotImplementedError

NotImplementedError:

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions