title: Extract target from Tensorflow PrefetchDataset
body: <p>I am still learning tensorflow and keras, and I suspect this question has a very easy answer I'm just missing due to lack of familiarity.</p>
  <p>I have a <code>PrefetchDataset</code> object:</p>
  <pre><code>&gt; print(tf_test)
  $ &lt;PrefetchDataset shapes: ((None, 99), (None,)), types: (tf.float32, tf.int64)&gt;
  </code></pre>
  <p>...made up of features and a target. I can iterate over it using a <code>for</code> loop:</p>
  <pre><code>&gt; for example in tf_test:
  &gt;     print(example[0].numpy())
  &gt;     print(example[1].numpy())
  &gt;     exit()
  $ [[-0.31 -0.94 -1.12 ... 0.18 -0.27]
     [-0.22 -0.54 -0.14 ... 0.33 -0.55]
     [-0.60 -0.02 -1.41 ... 0.21 -0.63]
     ...
     [-0.03 -0.91 -0.12 ... 0.77 -0.23]
     [-0.76 -1.48 -0.15 ... 0.38 -0.35]
     [-0.55 -0.08 -0.69 ... 0.44 -0.36]]
    [0 0 1 0 1 0 0 0 1 0 1 1 0 1 0 0 0
     ...
     0 1 1 0]
  </code></pre>
  <p>However, this is very slow.  What I'd like to do is access the tensor corresponding to the class labels and turn that into a numpy array, or a list, or any sort of iterable that can be fed into scikit-learn's classification report and/or confusion matrix:</p>
  <pre><code>&gt; y_pred = model.predict(tf_test)
  &gt; print(y_pred)
  $ [[0.01]
     [0.14]
     [0.00]
     ...
     [0.32]
     [0.03]
     [0.00]]
  &gt; y_pred_list = [int(x[0]) for x in y_pred]             # assumes value &gt;= 0.5 is positive prediction
  &gt; y_true = []                                           # what I need help with
  &gt; print(sklearn.metrics.confusion_matrix(y_true, y_pred_list)
  </code></pre>
  <p>...OR access the data such that it could be used in tensorflow's confusion matrix:</p>
  <pre><code>&gt; labels = []                                           # what I need help with
  &gt; predictions = y_pred_list                             # could we just use a tensor?
  &gt; print(tf.math.confusion_matrix(labels, predictions)
  </code></pre>
  <p>In both cases, the general ability to grab the target data from the original object in a manner that isn't computationally expensive would be very helpful (and might help with my underlying intuitions re: tensorflow and keras).</p>
  <p>Any advice would be greatly appreciated.</p>