class_docstr: Sparse matrix with DIAgonal storage.
  
  Now it has only one initializer format below:
  
  ``dia_matrix((data, offsets))``
  
  Args:
      arg1: Arguments for the initializer.
      shape (tuple): Shape of a matrix. Its length must be two.
      dtype: Data type. It must be an argument of :class:`numpy.dtype`.
      copy (bool): If ``True``, copies of given arrays are always used.
  
  .. seealso::
     :class:`scipy.sparse.dia_matrix`
class_docstr_tok: ["Sparse","matrix","with","DIAgonal","storage",".","Now","it","has","only","one","initializer","format","below",":","``","dia_matrix","(","(","data",",","offsets",")",")","``","Args",":","arg1",":","Arguments","for","the","initializer",".","shape","(","tuple",")",":","Shape","of","a","matrix",".","Its","length","must","be","two",".","dtype",":","Data","type",".","It","must","be","an","argument","of",":","class",":","`","numpy.dtype","`",".","copy","(","bool",")",":","If","``","True","``",",","copies","of","given","arrays","are","always","used",".","..","seealso",":",":",":","class",":","`","scipy.sparse.dia_matrix","`"]
docstr: Returns a matrix with the same sparsity structure as self,
  but with different data.  By default the structure arrays are copied.
docstr_tok: ["Returns","a","matrix","with","the","same","sparsity","structure","as","self",",","but","with","different","data",".","By","default","the","structure","arrays","are","copied","."]
code: def _with_data(self, data, copy=True):
      """Returns a matrix with the same sparsity structure as self,
      but with different data.  By default the structure arrays are copied.
      """
      if copy:
          return dia_matrix(
              (data, self.offsets.copy()), shape=self.shape
          )
      else:
          return dia_matrix((data, self.offsets), shape=self.shape)
  
file_path: cupy/cupyx/scipy/sparse/_dia.py
imports: import cupy
  from cupy import _core
  from cupyx.scipy.sparse import _csc
  from cupyx.scipy.sparse import _data
  from cupyx.scipy.sparse import _util
label_desc: Use image node_id 2 for calling the dia_matrix obj's underlying member method code with example usage: obj._with_data(data, copy) and returns: dia_matrix, dia_matrix