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 __init__(
      self, config: configs.GraphRegConfig, node_model_fn, **kwargs
  ):
      super(GraphRegularizationModel, self).__init__(**kwargs)
      self._graph_loss_multiplier = config.multiplier
      # Can't do this in build since our input is a dictionary.
      self._example_weights_fn = (
          graph_nets.blocks.EdgesToGlobalsAggregator(
              tf.math.unsorted_segment_sum
          )
      )
      self._node_model = node_model_fn()
      self._edge_model = GraphRegularizationEdgeModel(
          config.distance_config
      )
  
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 1 to create a new GraphRegularizationModel object from inherited base classes: NodeGraphModel with example: obj = GraphRegularizationModel(config, node_model_fn)