title: Conditional assignment of tensor values in TensorFlow
body: <p>I want to replicate the following <code>numpy</code> code in <code>tensorflow</code>. For example, I want to assign a <code>0</code> to all tensor indices that previously had a value of <code>1</code>.</p>
  
  <pre><code>a = np.array([1, 2, 3, 1])
  a[a==1] = 0
  
  # a should be [0, 2, 3, 0]
  </code></pre>
  
  <p>If I write similar code in <code>tensorflow</code> I get the following error.</p>
  
  <pre><code>TypeError: 'Tensor' object does not support item assignment
  </code></pre>
  
  <p>The condition in the square brackets should be arbitrary as in <code>a[a&lt;1] = 0</code>.</p>
  
  <p>Is there a way to realize this "conditional assignment" (for lack of a better name) in <code>tensorflow</code>?</p>