code: def to_sample_rdd(x, y, sc, num_slices=None):
      """
      Convert x and y into RDD[Sample]
      :param sc: SparkContext
      :param x: ndarray and the first dimension should be batch
      :param y: ndarray and the first dimension should be batch
      :param num_slices: The number of partitions for x and y.
      :return:
      """
      x_rdd = sc.parallelize(x, num_slices)
      y_rdd = sc.parallelize(y, num_slices)
      return x_rdd.zip(y_rdd).map(
          lambda item: Sample.from_ndarray(item[0], item[1])
      )
  
file_path: analytics-zoo/pyzoo/zoo/util/utils.py
imports: import glob
  from zoo.common import Sample
  import numpy
  from pyspark.ml.linalg import DenseVector, SparseVector, VectorUDT
label_desc: Use image node_id 1 for calling a global function with example usage: to_sample_rdd(x, y, sc, num_slices) and returns: x_rdd