-
Notifications
You must be signed in to change notification settings - Fork 74k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tf.contrib.data.prefetch_to_device not compatible with tf.data.Iterator.from_structure #19244
Comments
Thank you for your post. We noticed you have not filled out the following field in the issue template. Could you update them if they are relevant in your case, or leave them as N/A? Thanks. |
It has been 14 days with no activity and the |
Yes, this is still an issue. |
cc @mrry, I think the authority on this issue. |
@rohan100jain is working on a solution to this. |
Nagging Assignee @rohan100jain: It has been 14 days with no activity and this issue has an assignee. Please update the label and/or status accordingly. |
Nagging Assignee @rohan100jain: It has been 29 days with no activity and this issue has an assignee. Please update the label and/or status accordingly. |
Nagging Assignee @rohan100jain: It has been 44 days with no activity and this issue has an assignee. Please update the label and/or status accordingly. |
Please use CopyToDevice + Prefetch instead of using prefetch_to_device directly. for example ds = ... This should give you a regular dataset and all the other iterator / dataset support that comes with it. |
System information
Yes
Linux Ubuntu 16.04
tensorflow-gpu binary
N/A
v1.8.0-0-g93bc2e2072 1.8.0
3.6.3
CUDA 9.0 cuDNN 7.0.3
GTX 1070 8 GB VRAM
Describe the problem
This raises
NotImplementedError: prefetch_to_device() must be the last transformation in a dataset pipeline
.It is not possible to apply this to the dataset after the initializer has been created, since a new dataset is returned, instead of it being modified in place.
If one reads through this testcase, it is clear that it works when creating the iterator from the dataset.
It is not clear from the documentation of
make_initializer
that this function is a transformation of the dataset and thus counts as an additional step after prefetching.I am not sure if this is a bug/was overlooked, or is known to be not implemented.
Proposed short term solution:
prefetch_to_device
, that it is not supported in combination withmake_initializer
.make_initializer
that this operation modifies the dataset(although I don't think this is the correct choice of words, the issue is with a call to
dataset._as_variant_tensor
inmake_initializer
line 308).Proposed longterm solution:
Implement
_as_variant_tensor
for_PrefetchToDeviceDataset
.Reason why this is needed:
Creating the data pipeline using
from_structure
andmake_initializer
allows to dynamically switch the input source to the network, e.g. between training and testing set after an epoch without having to reinitialize the graph or fall back to using feed dicts.Source code / logs
Exact stack trace of the error:
The text was updated successfully, but these errors were encountered: