title: How does tf.keras.Model tell between features and label(s) in tf.data.Dataset and in TFRecords?
body: <p>I'm trying to create <code>tfrecords</code> files from CSV data, then I want to use <code>tf.data.TFRecordDataset()</code> to create <code>Dataset</code> from them, and then feed the <code>Dataset</code> to <code>tf.keras.Model</code>. (In fact I'm using <a href="https://github.com/tensorflow/ecosystem/tree/master/spark/spark-tensorflow-connector" rel="nofollow noreferrer">spark-tensorflow-connector</a> to create <code>tfrecords</code> files directly from Spark Dataframes.)</p>
  
  <p>In the <a href="https://www.tensorflow.org/api_docs/python/tf/keras/Model?hl=en#fit" rel="nofollow noreferrer"><code>fit()</code> method of <code>tf.keras.Model</code></a>, the argument <code>x</code> is the Input data. It could be:</p>
  
  <blockquote>
    <p>A tf.data dataset. Should return a tuple of either (inputs, targets)
    or (inputs, targets, sample_weights).</p>
  </blockquote>
  
  <p>Q1: <strong>Is this where <code>tf.keras.Model</code> knows where to separate the features and the labels?</strong> i.e., the features are the <code>inputs</code>, the labels are the <code>targets</code>.</p>
  
  <p>However in some examples, I could not see any "tuple" in the building of either the <code>tfrecords</code> files or the <code>tf.data.Dataset</code>. For example, in the following <a href="https://github.com/PacktPublishing/What-s-New-in-TensorFlow-2.0/blob/master/Chapter03/cifar10/create_tfrecords_from_cifar10.py" rel="nofollow noreferrer">example</a>, </p>
  
  <pre><code>def convert_to_tfrecord(input_files, output_file):
    """Converts a file to TFRecords."""
    print('Generating %s' % output_file)
    with tf.io.TFRecordWriter(output_file) as record_writer:
      for input_file in input_files:
        data_dict = read_pickle_from_file(input_file)
        data = data_dict[b'data']
        labels = data_dict[b'labels']
        num_entries_in_batch = len(labels)
        for i in range(num_entries_in_batch):
          example = tf.train.Example(features=tf.train.Features(
              feature={
                  'image': _bytes_feature(data[i].tobytes()),
                  'label': _int64_feature(labels[i])
              }))
          record_writer.write(example.SerializeToString())
  </code></pre>
  
  <p>...</p>
  
  <pre><code># Read dataset from tfrecords
  dataset = tf.data.TFRecordDataset(tfrecords_files)
  </code></pre>
  
  <p>Q2: <strong>So how does this <a href="https://github.com/PacktPublishing/What-s-New-in-TensorFlow-2.0/blob/master/Chapter03/cifar10/cifar10_classification.py" rel="nofollow noreferrer"><code>tf.keras.models.Sequential()</code> model</a> know where to find the features and where to find the labels?</strong> Why the model wouldn't take 'label' as a data feature?</p>