title: Tensorflow error: Using a `tf.Tensor` as a Python `bool` is not allowed
body: <p>I am struggling to implement an activation function in <a href="/questions/tagged/tensorflow" class="post-tag" title="show questions tagged &#39;tensorflow&#39;" rel="tag">tensorflow</a> in Python.</p>
  <p>The code is the following:</p>
  
  <pre class="lang-python prettyprint-override"><code>def myfunc(x):
      if (x &gt; 0):
          return 1
      return 0
  </code></pre>
  <p>But I am always getting the error:</p>
  <blockquote>
  <p>Using a <code>tf.Tensor</code> as a Python <code>bool</code> is not allowed. Use <code>if t is not None:</code></p>
  </blockquote>