title: Applying a cutoff value to a Tensor
body: <p>I want to apply a threshold to 1 column in a 2D tensor. Any value below the cutoff would be listed as <code>null</code> or <code>zero</code>. I have tried to avoid looping through the tensor and I want the input &amp; output tensor to have the same shape.</p>
  <p>Here is the code:</p>
  <pre><code>NFValue = tf.Variable(1.,dtype=tf.float64,constraint=lambda t: tf.clip_by_value(t, 10, 20))
  
  col1 = tf.gather(x, [0], axis=0)
  col2 = tf.gather(x, [1], axis=0)
  
  y = tf.fill(tf.shape(col2), NFValue)   # creates a tensor of the same size as X, with Cutoff
  y = tf.cast(y, np.float32)             # converts that tensor into the correct type for comparision.
  
  NewCol2 = tf.boolean_mask(col2, tf.math.greater(col2, y))
  
  return tf.concat([col1[0,:], NewCol2], axis=0)
  </code></pre>
  <p>The problem is that <code>tf.boolean_mask()</code> returns a tensor with just the values which were greater than <code>NFValue</code>. So the shape has changed.  <code>tf.Greater</code> will return a boolean vector of the correct shape, but I would need to loop through the tensor.</p>
  <p>I have tried several different options around this. I have looked at slice, <code>tf.Scan</code> and a couple different functions. I am expecting there to be a canned solution here.</p>