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