title: How to calculate the euclidean distance between a 2-D tensor and a 3-D tensor?
body: <p>I have a 2-D tensor <strong>A</strong> with the shape of (?, <em>L</em>) which refers to the features obtained through the neural network (where '?' is the batch size),  and a 3-D tensor <strong>B</strong> with the shape of (<em>N</em>, <em>K</em>, <em>L</em>). Obviously, there are <em>N</em> arrays with the shape of (<em>K</em>, <em>L</em>) in <strong>B</strong>, which are called <strong>C</strong> here.</p>
  
  <p>Now, how can I calculate the <strong>mean euclidean distance</strong> (average the distance of one row of <strong>A</strong> and each row of <strong>C</strong>) between each row of <strong>A</strong> and every <strong>C</strong> without iterations of every rows in  <strong>A</strong> and <strong>C</strong>, and finally return a vector with the shape of (?, <em>N</em>) ? </p>
  
  <p>For example, when the <strong>A</strong> with shape of (1, <em>L</em>), the result can be obtained as follows:</p>
  
  <pre><code>import tensorflow as tf
  
  with tf.Graph().as_default(), tf.Session() as sess:
      A = tf.placeholder(tf.float32, [1, None])
      B = tf.placeholder(tf.float32, [None, None, None])
      dist = tf.reduce_mean(tf.norm(B - A, axis=2), axis=1)
      print(sess.run(dist, feed_dict={A: [[1, 2, 3]],
                                      B: [[[ 4,  5,  6], [ 7,  8,  9]],
                                          [[10, 11, 12], [13, 14, 15]]]}))
      # [ 7.7942286 18.186533 ]
  </code></pre>
  
  <p>I want to know that when A = ([[1, 2, 3], [4, 5, 6]]) (it is just an example of <strong>A</strong> with the shape of (2, 3)), how can I get the result of the question above with the shape of [2, 2] ?</p>