title: TensorFlow: Example implementation of a simple custom transformation_func for Dataset's apply method
body: <p>I am trying to implement a simple custom <code>transformation_func</code> for the <a href="https://www.tensorflow.org/api_docs/python/tf/data/Dataset#apply" rel="nofollow noreferrer">apply</a> method in the Dataset API, but didn't find the docs particularly helpful.</p>
  
  <p>Specifically, my <code>dataset</code> contains video frames and corresponding labels: <code>{[frame_0, label_0], [frame_1, label_1], [frame_2, label_2],...}</code>.</p>
  
  <p>I'd like to transform it so that it additionally contains the previous frame for each label: <code>{[frame_0, frame_1, label_1], [frame_1, frame_2, label_2], [frame_2, frame_3, label_3],...}</code>.</p>
  
  <p>This could probably be achieved by doing something like <code>tf.data.Dataset.zip(dataset, dataset.skip(1))</code>, but then I would have duplicated labels.</p>
  
  <p>I have not been able to find a reference implementation of a <code>transformation_func</code>. Is anyone able to get me started on this?</p>