code: def to_tensor(adj, features, labels=None, device="cpu"):
      """Convert adj, features, labels from array or sparse matrix to
      torch Tensor.
      Parameters
      ----------
      adj : scipy.sparse.csr_matrix
          the adjacency matrix.
      features : scipy.sparse.csr_matrix
          node features
      labels : numpy.array
          node labels
      device : str
          'cpu' or 'cuda'
      """
      if sp.issparse(adj):
          adj = sparse_mx_to_torch_sparse_tensor(adj)
      else:
          adj = torch.FloatTensor(adj)
      if sp.issparse(features):
          features = sparse_mx_to_torch_sparse_tensor(features)
      else:
          features = torch.FloatTensor(np.array(features))
  
      if labels is None:
          return adj.to(device), features.to(device)
      else:
          labels = torch.LongTensor(labels)
          return adj.to(device), features.to(device), labels.to(device)
  
file_path: AutoGL/autogl/module/model/pyg/robust/utils.py
imports: import numpy
  import scipy.sparse
  import torch
label_desc: Use image node_id 3 for calling a global function with example usage: to_tensor(adj, features, labels, device) and returns: adj,  features, adj,  features,  labels