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

tf.Tensor as Python boolean error #8

Closed
aigujin opened this issue May 24, 2016 · 1 comment
Closed

tf.Tensor as Python boolean error #8

aigujin opened this issue May 24, 2016 · 1 comment

Comments

@aigujin
Copy link

aigujin commented May 24, 2016

Hi,
While running python main.py --dataset ptb, I got an error :

data = data[: batch_size * seq_length * math.floor(length / (batch_size * seq_length))]
data load done. Number of batches in train: 265, val: 21, test: 23
Word vocab size: 10001, Char vocab size: 51, Max word length (incl. padding): 21
Traceback (most recent call last):
File "main.py", line 66, in <module> tf.app.run()
File "/usr/local/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 30, in run sys.exit(main(sys.argv))
File "main.py", line 60, in main model.run(FLAGS.epoch, FLAGS.learning_rate, FLAGS.decay)
File "/Users/artur-imac/nn-models/lstm-char-cnn-tensorflow/models/LSTMTDNN.py", line 269, in run
    if grad:
File "/usr/local/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 475, in __nonzero__
    raise TypeError("Using a `tf.Tensor` as a Python `bool` is not allowed. "
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 the logical TensorFlow ops to test the value of a tensor.

I am using TensorFlow 0.8 with Python2.

@carpedm20
Copy link
Owner

@aigujin Thanks. This was because of the recent updates.

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