Reputation: 151
How would we prefetch only the training data and not the labels in a mini-batch since some cost functions like tf.nn.ctc_loss run on the CPU and therefore don't need the labels on GPU memory.
Upvotes: 0
Views: 557
Reputation: 32061
You would need to create two Dataset objects in order to achieve this. There are plenty of use cases for having two datasets, so this isn't so abnormal.
Note though that prefetch does not prefetch to the GPU, it appears that this has recently been added with prefetch_to_device
in TF 1.7.
A few more detailed references are available in this question:
Can I asynchronously prefetch to the GPU in tensorflow (1.4) using a two-variables approach?
Upvotes: 1