code: def __init__(self, spmatrix, shape=()):
      if shape and len(shape) != 2:
          raise ValueError("Only accept 2-d array")
      if isinstance(spmatrix, SparseMatrix):
          self.spmatrix = spmatrix.spmatrix
      else:
          self.spmatrix = spmatrix.tocsr()
  
imports: import numpy
  from collections.abc import Iterable
  from typing import List
  from .core import issparse, get_array_module, cp, cps, get_sparse_module, naked, sps, splinalg
  from .array import SparseNDArray, SparseArray
label_desc: Use image node_id 1 to create a new SparseMatrix object from inherited base classes: SparseArray with example: obj = SparseMatrix(spmatrix, shape)