code: def _convert_to_sparse_tensor(x):
      if x.ndim == 2:
          return sp_matrix_to_sp_tensor(x)
      elif x.ndim == 3:
          s1_, s2_, s3_ = x.shape
          return ops.reshape(
              sp_matrix_to_sp_tensor(x.reshape(s1_ * s2_, s3_)),
              (s1_, s2_, s3_),
          )
  
imports: import numpy
  import scipy.sparse
  import tensorflow
  from spektral.data.utils import to_disjoint
  from spektral.layers import ops
  from spektral.utils import convolution
  from spektral.utils.sparse import sp_batch_to_sp_tensor, sp_matrix_to_sp_tensor
label_desc: Use image node_id 2 for calling a global function with example usage: _convert_to_sparse_tensor(x) and returns: sp_matrix_to_sp_tensor, ops