title: Tensorflow 1.12 apply dataset.filter to dataset.window
body: <p>I have a sequential dataset from which I create windows in order to train an RNN. There are cases, where I want to throw away certain windows. However, when I use <code>dataset.window</code> followed by <code>dataset.filter</code> something breaks inside the pipeline. Here is a toy example, could someone please advise me on how to do this properly. This toy example demonstrates my issues. The below code creates windows of size 4 and then creates batches of 4 windows per batch. I want to throw away a window if the last element in the window is odd, so my batches will always be of size 4 but the windows inside the batch always have to end with an event element.</p>
  
  <pre><code>import tensorflow as tf
  sess = tf.InteractiveSession()
  ds = tf.data.Dataset.range(100)
  ds = ds.window(size=4, shift=1,
                 stride=1,
                 drop_remainder=True).flat_map(lambda x: x.batch(4))
  
  #*I want to keep the window if the last element in the window is even*
  ds = ds.filter(lambda x: x[3] % 2 == 0) 
  
  ds = ds.repeat()
  ds = ds.batch(4, drop_remainder=True)
  it = ds.make_one_shot_iterator()
  data = it.get_next()
  for i in range(100):
      print(sess.run([data]))
  sess.close()
  </code></pre>
  
  <p>And this throws the following error:</p>
  
  <pre><code>OutOfRangeError: End of sequence
       [[{{node IteratorGetNext_6}} = IteratorGetNext[output_shapes=[[4,?]], output_types=[DT_INT64], _device="/job:localhost/replica:0/task:0/device:CPU:0"](OneShotIterator_6)]]
  
  During handling of the above exception, another exception occurred:
  
  OutOfRangeError                           Traceback (most recent call last)
  &lt;ipython-input-54-d6d959b5be78&gt; in &lt;module&gt;
        1 for i in range(100):
  ----&gt; 2     print(sess.run([data]))
  </code></pre>