【发布时间】:2016-12-01 17:39:08
【问题描述】:
我想在我的 Python 3.5 代码中使用 Tensorflow 和 TFLearn 库。我已经使用pip 安装了两者。我有以下版本:
tensorflow 0.12.0rc0
tflearn 0.2.1
python 3.5.2
conda 4.2.13
但是,在运行某些代码时,我收到以下错误:
TypeError: Using a `tf.Tensor` as a Python `bool` is not allowed.
从this issue on GitHub 得知,这个问题应该已经解决了。
我该如何解决这个问题?
编辑:这是完整的堆栈跟踪:
Traceback (most recent call last):
File "test.py", line 35, in <module>
agent = DQNAgent(create_mlp, n_actions, env.observation_space.shape, min_replay_size=10000, batch_size=64)
File "agents.py", line 86, in __init__
self.q_net = network_fn(self.s, self._n_actions)
File "test.py", line 23, in create_mlp
net = nn.input_data(placeholder=inputs)
File "//anaconda/lib/python3.5/site-packages/tflearn/layers/core.py", line 55, in input_data
if not shape and not placeholder:
File "//anaconda/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 533, in __bool__
raise TypeError("Using a `tf.Tensor` as a Python `bool` is not allowed. "
【问题讨论】:
-
你能分享错误的完整堆栈跟踪吗?这将使我们能够查明哪些代码不正确。
标签: python-3.x tensorflow