code: def sparse_mx_to_torch_sparse_tensor(sparse_mx):
      """Convert a scipy sparse matrix to a torch sparse tensor."""
      sparse_mx = sparse_mx.tocoo().astype(np.float32)
      sparserow = torch.LongTensor(sparse_mx.row).unsqueeze(1)
      sparsecol = torch.LongTensor(sparse_mx.col).unsqueeze(1)
      sparseconcat = torch.cat((sparserow, sparsecol), 1)
      sparsedata = torch.FloatTensor(sparse_mx.data)
      return torch.sparse.FloatTensor(
          sparseconcat.t(), sparsedata, torch.Size(sparse_mx.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 7 for calling a global function with example usage: sparse_mx_to_torch_sparse_tensor(sparse_mx) and returns: torch