title: Tensorflow - Map-Function
body: <p>I have a question concerning tf's map function.
  I encounter weird behavior with this function. If I do as stated in manual </p>
  
  <pre><code>label_tensor # shape [150, 1]
  y = tf.map_fun(lambda x: x*x, label_tensor)
  #  returns y as a tensor with label_tensor x^2
  </code></pre>
  
  <p>however, if i want to implement my own function it doesn't seem to work. It just always passes a tensor to the specified function which is not made to handle tensors.</p>
  
  <pre><code>y = tf.map_fn(special_fun, label_tensor)
  
  def special_fun(key):
      return int(2000 * round(float(key)/2000))
  
  #  TypeError: float() argument must be a string or a number, not 'Tensor'
  </code></pre>
  
  <p>I am somehow not seeing the issue here.
  Also if I try something like:
      tmp_label_list = tf.Session().run(label_tensor)
      print(tmp_label_list)
      #  prints out an evaluated list, [1, 2, 3, 3, 1, 2, 2,...]
  But if I then pass <code>[special_fun(i) for i in tmp_label_list]</code> it raises the Type-Error again, that it expected no <code>'Tensor'</code></p>
  
  <p>What am I missing or doing wrong? Thanks in advance.</p>