code: def create_tensorrec_dataset_from_sparse_matrix(sparse_matrix):
      """
      Creates a TensorFlow Dataset containing the data from the given sparse matrix.
      :param sparse_matrix: scipy.sparse matrix
      The data to be contained in this Dataset.
      :return: tf.data.Dataset
      """
      if not isinstance(sparse_matrix, sp.coo_matrix):
          sparse_matrix = sp.coo_matrix(sparse_matrix)
  
      row_index = np.array([sparse_matrix.row], dtype=np.int64)
      col_index = np.array([sparse_matrix.col], dtype=np.int64)
      values = np.array([sparse_matrix.data], dtype=np.float32)
      n_dim_0 = np.array([sparse_matrix.shape[0]], dtype=np.int64)
      n_dim_1 = np.array([sparse_matrix.shape[1]], dtype=np.int64)
  
      tensor_slices = (row_index, col_index, values, n_dim_0, n_dim_1)
  
      return tf.data.Dataset.from_tensor_slices(tensor_slices)
  
file_path: tensorrec/tensorrec/input_utils.py
imports: import numpy
  from scipy import sparse
  import tensorflow
  from .session_management import get_session
label_desc: Use image node_id 2 for calling a global function with example usage: create_tensorrec_dataset_from_sparse_matrix(sparse_matrix) and returns: tf