class_docstr: Example model for using `PairwiseDistance` by subclassing.
class_docstr_tok: ["Example","model","for","using","`","PairwiseDistance","`","by","subclassing","."]
code: def call(self, inputs):
      features = inputs["features"]
      neighbors = inputs["neighbors"]
      neighbor_weights = inputs["neighbor_weights"]
      # Forward pass.
      logits = self._unregularized_model(features)
      # Add regularization.
      graph_loss = self._regularizer(
          sources=logits,
          targets=self._unregularized_model(neighbors),
          weights=neighbor_weights,
      )
      self.add_loss(graph_loss)
      self.add_metric(graph_loss, aggregation="mean", name="graph_loss")
      return logits
  
file_path: neural-structured-learning/neural_structured_learning/keras/layers/layers_test.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import itertools
  from absl.testing import parameterized
  from neural_structured_learning import configs
  from neural_structured_learning.keras import layers
  import numpy
  import tensorflow
label_desc: Use image node_id 2 for calling the _PairwiseRegularizedModel obj's underlying member method code with example usage: obj.call(inputs) and returns: logits