class_docstr: Distance block.
class_docstr_tok: ["Distance","block","."]
code: def __init__(self, num_features, num_gpus):
      self.num_features = num_features
      self.num_gpus = num_gpus
  
      # Initialize TF graph to calculate pairwise distances.
      with tf.device("/cpu:0"):
          self._features_batch1 = tf.placeholder(
              tf.float16, shape=[None, self.num_features]
          )
          self._features_batch2 = tf.placeholder(
              tf.float16, shape=[None, self.num_features]
          )
          features_split2 = tf.split(
              self._features_batch2, self.num_gpus, axis=0
          )
          distances_split = []
          for gpu_idx in range(self.num_gpus):
              with tf.device("/gpu:%d" % gpu_idx):
                  distances_split.append(
                      batch_pairwise_distances(
                          self._features_batch1,
                          features_split2[gpu_idx],
                      )
                  )
          self._distance_block = tf.concat(distances_split, axis=1)
  
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 to create a new DistanceBlock object  with example: obj = DistanceBlock(num_features, num_gpus)