class_docstr: Model that does graph regularization given a node model.
class_docstr_tok: ["Model","that","does","graph","regularization","given","a","node","model","."]
code: def graph_call(self, graph, **kwargs):
      # Convert the inputs to a graph and run the model.
      example_weights = tf.reshape(
          self._example_weights_fn(graph), (-1,)
      )
      snt.allow_empty_variables(self._example_weights_fn)
      graph = graph_nets.modules.GraphIndependent(
          node_model_fn=lambda: self._node_model
      )(graph)
      graph = EdgeRelationNetwork(
          edge_model_fn=lambda: self._edge_model,
          global_model_fn=lambda: (lambda x: x),
      )(graph)
      graph_loss = tf.math.reduce_mean(
          tf.math.divide_no_nan(graph.globals, example_weights),
          name="graph_loss",
      )
      self.add_metric(graph_loss, aggregation="mean", name="graph_loss")
      self.add_loss(self._graph_loss_multiplier * graph_loss)
      return graph
  
imports: import functools
  from typing import Dict, Optional, Text
  import graph_nets
  import neural_structured_learning.configs
  import neural_structured_learning.keras
  import neural_structured_learning.lib
  import sonnet.v2
  import tensorflow
label_desc: Use image node_id 2 for calling the GraphRegularizationModel obj's underlying member method code with example usage: obj.graph_call(graph) and returns: graph