Skip to content

TypeError: Using a tf.Tensor as a Python bool is not allowed. Use if t is not None: instead of if t: #2

Description

@PellyKoo

Thanks for sharing the code.when I try to run the source code,I have some problems below:

File "/media/gu/Document/Visual Segmention/SegNet-tensorflow-master/SegNet.py", line 94, in init
training=self.with_dropout_pl, name="dropout1")
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/layers/core.py", line 301, in dropout
layer = Dropout(rate, noise_shape=noise_shape, seed=seed, name=name)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/layers/core.py", line 247, in init
self.rate = min(1., max(0., rate))
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/ops.py", line 564, in bool
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.

Could you give me some help?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions