TypeError:不允许使用`tf.Tensor`作为Python`bool`

时间:2016-12-01 17:39:08

标签: python-3.x tensorflow

我想在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. "

0 个答案:

没有答案