code: def __narrow_diag__(
      src: SparseTensor, start: Tuple[int, int], length: Tuple[int, int]
  ) -> SparseTensor:
      # This function builds the inverse operation of `cat_diag` and should hence
      # only be used on *diagonally stacked* sparse matrices.
      # That's the reason why this method is marked as *private*.
  
      rowptr, col, value = src.csr()
  
      rowptr = rowptr.narrow(0, start=start[0], length=length[0] + 1)
      row_start = int(rowptr[0])
      rowptr = rowptr - row_start
      row_length = int(rowptr[-1])
  
      row = src.storage._row
      if row is not None:
          row = row.narrow(0, row_start, row_length) - start[0]
  
      col = col.narrow(0, row_start, row_length) - start[1]
  
      if value is not None:
          value = value.narrow(0, row_start, row_length)
  
      sparse_sizes = length
  
      rowcount = src.storage._rowcount
      if rowcount is not None:
          rowcount = rowcount.narrow(0, start[0], length[0])
  
      colptr = src.storage._colptr
      if colptr is not None:
          colptr = colptr.narrow(0, start[1], length[1] + 1)
          colptr = colptr - int(colptr[0])  # i.e. `row_start`
  
      colcount = src.storage._colcount
      if colcount is not None:
          colcount = colcount.narrow(0, start[1], length[1])
  
      csr2csc = src.storage._csr2csc
      if csr2csc is not None:
          csr2csc = csr2csc.narrow(0, row_start, row_length) - row_start
  
      csc2csr = src.storage._csc2csr
      if csc2csr is not None:
          csc2csr = csc2csr.narrow(0, row_start, row_length) - row_start
  
      storage = SparseStorage(
          row=row,
          rowptr=rowptr,
          col=col,
          value=value,
          sparse_sizes=sparse_sizes,
          rowcount=rowcount,
          colptr=colptr,
          colcount=colcount,
          csr2csc=csr2csc,
          csc2csr=csc2csr,
          is_sorted=True,
      )
      return src.from_storage(storage)
  
imports: from typing import Tuple
  from torch_sparse.storage import SparseStorage
  from torch_sparse.tensor import SparseTensor
label_desc: Use image node_id 2 for calling a global function with example usage: __narrow_diag__(src, start, length) and returns: src