title: Binary mask in Tensorflow
body: <p>I would like to mask every other value along a particular dimension of a Tensor but don't see a good way to generate such a mask. For example</p>
  
  <pre><code>#Masking on the 2nd dimension
  a = [[1,2,3,4,5],[6,7,8,9,0]
  mask = [[1,0,1,0,1],[1,1,1,1,1]]
  b = a * mask #would return [[1,0,3,0,5],[6,0,8,0,0]]
  </code></pre>
  
  <p>Is there an easy way to generate such a mask?</p>
  
  <p>Ideally I would like to do something like the following:</p>
  
  <pre><code>mask = tf.ones_like(input_tensor)
  mask[:,::2] = 0
  mask * input_tensor
  </code></pre>
  
  <p>But slice assigning doesn't seem to be as simple as in Numpy.</p>