简体   繁体   English

如何在Tensorflow V2中将tf.data.Dataset与图表一起使用?

[英]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. 我发现Tensorflow V2中已弃用了诸如make_one_shot_iterator函数,建议for ... in dataset ,这需要启用急切执行。 I'm confused that without these functions, how can we extract data from Dataset with graphs? 我很困惑,如果没有这些功能,我们如何从带有图形的数据Dataset提取数据? It seems to me now that the only choice is to turn to tf.compat.v1.data.make_one_shot_iterator(dataset) . 在我看来,现在唯一的选择是转到tf.compat.v1.data.make_one_shot_iterator(dataset) Are there any suggested choice in V2? 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. 根据官方文档,数据集将在TF 2.0中变为可迭代的,并且默认情况下将启用紧急模式。 You can find more about it here 你可以在这里找到更多关于它的信息
https://github.com/tensorflow/docs/blob/master/site/en/r2/guide/effective_tf2.md https://github.com/tensorflow/docs/blob/master/site/en/r2/guide/effective_tf2.md

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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