After reading through the tf.data documentation (here for TF 1.15), related TF code (both Python and C++), I realized that most of it seems to run purely on CPU, except of PrefetchDataset.
Is that true?
The documentation for prefetch_to_device says:
NOTE: Although the transformation creates a
tf.data.Dataset, the transformation must be the finalDatasetin the input pipeline.
Which suggest that all other datasets cannot handle such a GPU-based dataset.
While looking through the code, there seems to be some internal datasets, e.g. _CopyToDeviceDataset and _MapOnGpuDataset, which might handle GPU datasets.
If I want to have my preprocessing (e.g. data augmentation, some other clever non-trivial stuff) on GPU, that means that I cannot use tf.data? (I also want to use graph mode, but not sure if that is relevant.)
Now I also found _GeneratorDataset. That kernel also is defined on GPU. So that means that if my next_func returns a tensor on GPU, it will always stay on GPU?