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 to_chunk_op(self, *args):
      _, idx, chunk_size = args
  
      xps = cps if self.gpu else sps
      if len(self.shape) == 1:
          shape = (1, self.shape[0])
      else:
          shape = self.shape
      data = xps.csr_matrix(
          (self.data, self.indices, self.indptr), shape
      )
      chunk_data = data[get_chunk_slices(chunk_size, idx)]
  
      chunk_op = self.copy().reset_key()
      chunk_op.data = chunk_data.data
      chunk_op.indices = chunk_data.indices
      chunk_op.indptr = chunk_data.indptr
      chunk_shape = (
          chunk_data.shape[1:]
          if len(self.shape) == 1
          else chunk_data.shape
      )
      chunk_op.shape = chunk_shape
  
      return chunk_op
  
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 2 for calling the CSRMatrixDataSource obj's underlying member method code with example usage: obj.to_chunk_op() and returns: chunk_op