title: Chamfer distance between two point clouds in tensorflow
body: <p>I am trying to implement chamfer distance in tensorflow.</p>
  
  <p>But, my code is taking input as numpy array. To convert a numpy into a tensor, we need to run a session, but the process is already in another session. I think two sessions can't run in parallel.</p>
  
  <p>So, can anyone help me with the implementation of chamfer distance in tensorflow or help me with this problem of two simultaneous sessions?</p>
  
  <p>my code is:</p>
  
  <pre><code>def chamfer_distance(array1,array2):
      # final = 0
      # final = tf.cast(final,tf.float32)
      batch_size = array1.get_shape()[0].value
      num_point = array1.get_shape()[1].value
      sess = tf.Session()
      arr1,arr2 = sess.run([array1,array2])
      del sess
      dist = 0
      for i in range(batch_size):
          tree1 = KDTree(arr1[i], leafsize=num_point+1)
          tree2 = KDTree(arr2[i], leafsize=num_point+1)
          distances1, _ = tree1.query(arr2[i])
          distances2, _ = tree2.query(arr1[i])
          distances1 = tf.convert_to_tensor(distances1)
          distances2 = tf.convert_to_tensor(distances2)
          av_dist1 = tf.reduce_mean(distances1)
          av_dist2 = tf.reduce_mean(distances2)
          dist = dist + (av_dist1+av_dist2)/batch_size
      return dist
  </code></pre>