code: def convert_data(X):
      if issparse(X):
          return csr_matrix(X, dtype=np.float32)
  
      data = np.array(X, dtype=np.float32, copy=False, order="C")
      if data.ndim != 2:
          raise ValueError("X must be of shape (n_samples, n_features)")
      return data
  
file_path: neoml/NeoML/Python/neoml/Utils.py
imports: import numpy
  from scipy.sparse import csr_matrix, issparse
  from neoml.Dnn.Dnn import Layer
label_desc: Use image node_id 2 for calling a global function with example usage: convert_data(X) and returns: data, csr_matrix