title: Tensorflow: Filter a tensor out of a list of tensors
body: <p>I'm using a dataset where I parse in four tensors from each tfrecord file. Every so often, one of the four tensors will be empty and I would like to be able to filter out this tensor and send the rest of the tensors to the next step in the tf.data pipeline. I keep the four tensors in a dictionary and I'd like to be able to do something like this.</p>
  
  <pre class="lang-py prettyprint-override"><code>@tf.function
  def filter_and_reshape(tensor_dict, shape):
      return {k: tf.reshape(t, shape)
              for k, t in tensor_dict.items() if not tf.equal(tf.size(t), 0)}
  </code></pre>
  
  <p>Where <code>tensor_dict</code> is a dictionary of the tensors I've just parsed from a file, but not yet restored to their original shape.</p>
  
  <p>Unfortunately this does not work since <code>tf.equal(tf.size(t), 0)</code> returns a tensor not a bool, and it doesn't seem like autograph can fix the issue.</p>
  
  <p>Is there any alternate way to do this?</p>