class_docstr: Tests for `pairwise_distance_lib.PairwiseDistance`.
class_docstr_tok: ["Tests","for","`","pairwise_distance_lib.PairwiseDistance","`","."]
docstr: Makes a function from config and runs it.
docstr_tok: ["Makes","a","function","from","config","and","runs","it","."]
code: def testCall(self):
      """Makes a function from config and runs it."""
      regularizer = pairwise_distance_lib.PairwiseDistance(
          configs.DistanceConfig(
              distance_type=configs.DistanceType.KL_DIVERGENCE,
              sum_over_axis=-1,
          ),
          name="kl_loss",
      )
      # Run a computation.
      example = np.array([0.3, 0.3, 0.4])
      neighbors = np.array([[0.9, 0.05, 0.05]])
      kl_loss = self.evaluate(regularizer(example, neighbors))
      # Assert correctness of KL divergence calculation.
      self.assertNear(
          kl_loss, np.sum(special.kl_div(example, neighbors)), _ERR_TOL
      )
  
file_path: neural-structured-learning/neural_structured_learning/keras/layers/pairwise_distance_test.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import neural_structured_learning.configs
  from neural_structured_learning.keras.layers import pairwise_distance
  import numpy
  from scipy import special
  import tensorflow
  from tensorflow.python.framework import test_util
label_desc: Use image node_id 2 for calling the PairwiseDistanceTest obj's underlying member method code with example usage: obj.testCall() without return types