class_docstr: Represents data from sparse array include scipy sparse or cupy sparse matrix.
class_docstr_tok: ["Represents","data","from","sparse","array","include","scipy","sparse","or","cupy","sparse","matrix","."]
code: def execute(cls, ctx, op: "CSRMatrixDataSource"):
      xps = cps if op.gpu else sps
      chunk_shape = (
          (1, op.shape[0]) if op.outputs[0].ndim == 1 else op.shape
      )
      ctx[op.outputs[0].key] = SparseNDArray(
          xps.csr_matrix(
              (op.data, op.indices, op.indptr), shape=chunk_shape
          ),
          shape=op.shape,
      )
  
imports: import numpy
  from ...None import opcodes
  from ...lib.sparse.core import issparse, get_array_module, cp, cps, sps
  from ...lib.sparse import SparseNDArray
  from ...serialization.serializables import FieldTypes, AnyField, NDArrayField, TupleField
  from ...utils import on_serialize_shape, on_deserialize_shape
  from ..core import TENSOR_TYPE, TensorOrder, TensorData, Tensor
  from ..utils import get_chunk_slices
  from ..array_utils import array_module, is_array, is_cupy
  from .core import TensorNoInput
  from .scalar import scalar
label_desc: Use image node_id 3 for calling the CSRMatrixDataSource obj's underlying member method code with example usage: obj.execute(cls, ctx, op) without return types