简体   繁体   中英

How to use `tf.data.Dataset` in Tensorflow V2 with graphs?

I spot that functions, such as make_one_shot_iterator , have been deprecated in Tensorflow V2, and the suggestion is to use for ... in dataset , which requires eager execution enabled. I'm confused that without these functions, how can we extract data from Dataset with graphs? It seems to me now that the only choice is to turn to tf.compat.v1.data.make_one_shot_iterator(dataset) . Are there any suggested choice in V2? Why would these functions be removed?

As per official documentation, Datasets will become iterables in TF 2.0 and eager mode will be enabled bu default. You can find more about it here
https://github.com/tensorflow/docs/blob/master/site/en/r2/guide/effective_tf2.md

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM