title: How to use tensorflow.data.Dataset.flat_map(my_func) with a function of multiple paramters?
body: <p>I have this code as part of windowing function:</p>
  <pre><code>    dataset = tf.data.Dataset.from_tensor_slices(series)
      dataset = dataset.window(size=window_size, shift=1, drop_remainder=True)
      dataset = dataset.flat_map(lambda window: window.batch(window_size))
  </code></pre>
  <p>However, in the TF Certification exam I can't use <strong>lambda</strong>! so, I need to get rid of the <strong>lambda</strong> part. I tried using a function like so:</p>
  <pre><code>def window_to_tensor(window_ds: tf.data.Dataset, window_size: int):
      return window_ds.batch(window_size)
  
  dataset = dataset.flat_map(window_to_tensor ,window_size)
  </code></pre>
  <p>But I get an error:</p>
  <blockquote>
  <p>TypeError: flat_map() takes 2 positional arguments but 3 were given</p>
  </blockquote>
  <p>Even when I try to use two functions like below, I get a similar error:</p>
  <pre><code>dataset = dataset.apply(window_to_tensor,window_size)
  dataset = tf.keras.backend.flatten(dataset)
  </code></pre>
  <p>How can I map a function then flatten the resulting dataset without using flat_map (or with using it but without lambda)? (I am required to use TF2.0.0)</p>