title: One hot encoding when reading into tf.dataset
body: <p>I am running a tensorflow model on the gcp-ai platform. The dataset is large and not everything can be kept in memory at the same time, therefore I read the data into a <code>tf.dataset</code> using the following code:</p>
  
  <pre><code>def read_dataset(filepattern):
      def decode_csv(value_column):
          cols = tf.io.decode_csv(value_column, record_defaults=[[0.0],[0],[0.0])
          features=[cols[1],cols[2]]
          label = cols[0]
          return features, label
      # Create list of files that match pattern
      file_list = tf.io.gfile.glob(filepattern)
      # Create dataset from file list
      dataset = tf.data.TextLineDataset(file_list).map(decode_csv)
      return dataset
  
  training_data=read_dataset(&lt;filepattern&gt;)
  </code></pre>
  
  <p>The problem is that the second column in my data is categorical, and I need to use one hot encoding. How can this be done, either in the function <code>decode_csv</code> or manipulate the <code>tf.dataset</code> later.</p>