tensorflow2_tutorials_chinese
tensorflow2_tutorials_chinese copied to clipboard
为什么我的tensorflow2.0不支持python的if 还有while 这些语句,即使我加了@tf.function
你那边说的不支持是什么意思,功能无效吗?发一下具体代码。 我这边可以正常运行
出现这个结果,
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哇,不知道为什么,
可能命令行单条输入,它不能事先构造好图直接执行了。喜欢交互式输入欢迎使用jupyter-notebook,你会喜欢上它的
原来是这个原因,我回去用jupyter-notebook试一试,不能在命令行使用,算不算bug?