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

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. #15

Open
atulkoc opened this issue Feb 7, 2018 · 5 comments

Comments

@atulkoc
Copy link

atulkoc commented Feb 7, 2018

i don't exactly know why i am facing this error.any solutions to it.

File "/home/atul/Desktop/train.py", line 196, in
pred = colornet(tensors)
File "/home/atul/Desktop/train.py", line 67, in colornet
conv1 = tf.nn.relu(tf.nn.conv2d(batch_norm(_tensors["conv4_3"], 512, phase_train),_tensors["weights"]["wc1"], [1, 1, 1, 1], 'SAME'))
File "/home/atul/Desktop/train.py", line 45, in batch_norm
x = bn.normalize(x, train=phase_train)
File "/home/atul/Desktop/batchnorm.py", line 45, in normalize
if train:
File "/home/atul/.local/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 620, 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 TensorFlow ops such as tf.cond to execute subgraphs conditioned on the value of a tensor.

@atulkoc atulkoc changed the title i don't exactly know why i am facing this error.any solutions to it. 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. Feb 7, 2018
@samhithaaaa
Copy link

same error,someone please help

@Shenmos7
Copy link

I also encountered the same problem,please

@wunian1015
Copy link

solved?I also have this problem,please

@samhithaaaa
Copy link

solved?I also have this problem,please

yes

@HeChengBeiDou
Copy link

please tell me how to solve it

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

5 participants