code: def _check_op_sparse(op, numpy_inputs, convert_to_sparse, **kwargs):
      tf_inputs = []
      for i in range(len(numpy_inputs)):
          if convert_to_sparse[i]:
              tf_inputs.append(
                  _convert_to_sparse_tensor(numpy_inputs[i])
              )
          else:
              tf_inputs.append(tf.convert_to_tensor(numpy_inputs[i]))
      tf_inputs = _cast_all_to_dtype(tf_inputs, np.float32)
  
      output = op(*tf_inputs, **kwargs)
  
      if hasattr(output, "toarray"):
          return output.toarray()
      elif hasattr(output, "numpy"):
          return output.numpy()
      elif isinstance(output, tf.SparseTensor):
          return tf.sparse.to_dense(output).numpy()
      else:
          return np.asarray(output)
  
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 6 for calling a global function with example usage: _check_op_sparse(op, numpy_inputs, convert_to_sparse) and returns: output, output, tf, np