code: def convert_covertype_dataset(file_path, buffer_size=40000):
      with tf.io.gfile.GFile(file_path, "r") as infile:
          data_array = np.genfromtxt(infile, dtype=int, delimiter=",")
      contexts = data_array[:, :-1]
      context_tensor = tf.cast(contexts, tf.float32)
      labels = data_array[:, -1] - 1  # Classes are from [1, 7].
      label_tensor = tf.cast(labels, tf.int32)
      return (
          tf.data.Dataset.from_tensor_slices(
              (context_tensor, label_tensor)
          )
          .repeat()
          .shuffle(buffer_size=buffer_size)
      )
  
file_path: agents/tf_agents/bandits/environments/dataset_utilities.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import csv
  import gin
  import numpy
  from six.moves import range
  from six.moves import zip
  import tensorflow
  import tensorflow_probability
label_desc: Use image node_id 5 for calling a global function with example usage: convert_covertype_dataset(file_path, buffer_size) and returns: tf