code: def batch_pairwise_distances(U, V):
      """Compute pairwise distances between two batches of feature vectors."""
      with tf.variable_scope("pairwise_dist_block"):
          # Squared norms of each row in U and V.
          norm_u = tf.reduce_sum(tf.square(U), 1)
          norm_v = tf.reduce_sum(tf.square(V), 1)
  
          # norm_u as a row and norm_v as a column vectors.
          norm_u = tf.reshape(norm_u, [-1, 1])
          norm_v = tf.reshape(norm_v, [1, -1])
  
          # Pairwise squared Euclidean distances.
          D = tf.maximum(
              norm_u - 2 * tf.matmul(U, V, False, True) + norm_v, 0.0
          )
  
      return D
  
file_path: insightface/reconstruction/ostec/external/stylegan2/metrics/precision_recall.py
imports: import os
  import numpy
  import tensorflow
  import dnnlib
  import dnnlib.tflib
  from metrics import metric_base
  from training import misc
label_desc: Use image node_id 1 for calling a global function with example usage: batch_pairwise_distances(U, V) and returns: D