Skip to content
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

为什么我的tensorflow2.0不支持python的if 还有while 这些语句,即使我加了@tf.function #3

Open
yuanzhoulvpi2017 opened this issue May 6, 2019 · 4 comments

Comments

@yuanzhoulvpi2017
Copy link

No description provided.

@yuanzhoulvpi2017 yuanzhoulvpi2017 changed the title 为什么我的tensorflow2.0不支持python 为什么我的tensorflow2.0不支持python的if 还有while 这些语句,即使我加了@tf.function May 6, 2019
@czy36mengfei
Copy link
Owner

image
你那边说的不支持是什么意思,功能无效吗?发一下具体代码。
我这边可以正常运行

@yuanzhoulvpi2017
Copy link
Author

image
出现这个结果,
TypeError: Using a tf.Tensor as a Python bool is not allowed. Use if t is not None: instead of if t: to test if a tensor is defined, and use TensorFlow ops such as tf.cond to execute subgraphs conditioned on the value of a tensor.
我这个是2.0哇,不知道为什么,

@czy36mengfei
Copy link
Owner

可能命令行单条输入,它不能事先构造好图直接执行了。喜欢交互式输入欢迎使用jupyter-notebook,你会喜欢上它的

@yuanzhoulvpi2017
Copy link
Author

原来是这个原因,我回去用jupyter-notebook试一试,不能在命令行使用,算不算bug?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants