code: def to_scipy(tensor):
      """Convert a dense/sparse tensor to scipy matrix"""
      if is_sparse_tensor(tensor):
          values = tensor._values()
          indices = tensor._indices()
          return sp.csr_matrix(
              (values.cpu().numpy(), indices.cpu().numpy()),
              shape=tensor.shape,
          )
      else:
          indices = tensor.nonzero().t()
          values = tensor[indices[0], indices[1]]
          return sp.csr_matrix(
              (values.cpu().numpy(), indices.cpu().numpy()),
              shape=tensor.shape,
          )
  
file_path: AutoGL/autogl/module/model/pyg/robust/utils.py
imports: import numpy
  import scipy.sparse
  import torch
label_desc: Use image node_id 5 for calling a global function with example usage: to_scipy(tensor) and returns: sp, sp