title: How does tf.map_fn work?
body: <p>Look at the demo:</p>
  
  <pre><code>elems = np.array([1, 2, 3, 4, 5, 6])
  squares = map_fn(lambda x: x * x, elems)
  # squares == [1, 4, 9, 16, 25, 36]
  
  elems = (np.array([1, 2, 3]), np.array([-1, 1, -1]))
  alternate = map_fn(lambda x: x[0] * x[1], elems, dtype=tf.int64)
  # alternate == [-1, 2, -3]
  
  elems = np.array([1, 2, 3])
  alternates = map_fn(lambda x: (x, -x), elems, dtype=(tf.int64, tf.int64))
  # alternates[0] == [1, 2, 3]
  # alternates[1] == [-1, -2, -3]
  </code></pre>
  
  <p>I can't understand the second and third.</p>
  
  <p>For the second: 
  I think the result is [2, -1], because the first time x=np.array([1, 2, 3]) and return 1*2, the second time x=np.array([-1, 1, -1]) and return 1*(-1)</p>
  
  <p>For the third:
  I think the shape of result is (3,2), because the first time x=1 and return (1,-1), the second time x=2 and return (2,-2), the third time x=3 and return (3,-3).</p>
  
  <p>So how does map_fn work?</p>