class_docstr: Global block.
  
  A block that updates the global features of each graph in a batch based on
  (a subset of) the previous global features, the aggregated features of the
  edges of the graph, and the aggregated features of the nodes of the graph.
  
  See https://arxiv.org/abs/1806.01261 for more details.
class_docstr_tok: ["Global","block",".","A","block","that","updates","the","global","features","of","each","graph","in","a","batch","based","on","(","a","subset","of",")","the","previous","global","features",",","the","aggregated","features","of","the","edges","of","the","graph",",","and","the","aggregated","features","of","the","nodes","of","the","graph",".","See","https",":","\/\/arxiv.org\/abs\/1806.01261","for","more","details","."]
docstr: Initializes the GlobalBlock module.
  
  Args:
    global_model_fn: A callable that will be called in the variable scope of
      this GlobalBlock and should return a Sonnet module (or equivalent
      callable) to be used as the global model. The returned module should
      take a `Tensor` (of concatenated input features) and return a `Tensor`
      (the global output features). Typically, this module would input and
      output `Tensor`s of rank 2, but it may also input or output larger
      ranks. See the `_build` method documentation for more details on the
      acceptable inputs to this module in that case.
    use_edges: (bool, default=True) Whether to condition on aggregated edges.
    use_nodes: (bool, default=True) Whether to condition on node attributes.
    use_globals: (bool, default=True) Whether to condition on global
      attributes.
    nodes_reducer: Reduction to be used when aggregating nodes. This should
      be a callable whose signature matches tf.math.unsorted_segment_sum.
    edges_reducer: Reduction to be used when aggregating edges. This should
      be a callable whose signature matches tf.math.unsorted_segment_sum.
    name: The module name.
  
  Raises:
    ValueError: When fields that are required are missing.
docstr_tok: ["Initializes","the","GlobalBlock","module",".","Args",":","global_model_fn",":","A","callable","that","will","be","called","in","the","variable","scope","of","this","GlobalBlock","and","should","return","a","Sonnet","module","(","or","equivalent","callable",")","to","be","used","as","the","global","model",".","The","returned","module","should","take","a","`","Tensor","`","(","of","concatenated","input","features",")","and","return","a","`","Tensor","`","(","the","global","output","features",")",".","Typically",",","this","module","would","input","and","output","`","Tensor","`","s","of","rank","2",",","but","it","may","also","input","or","output","larger","ranks",".","See","the","`","_build","`","method","documentation","for","more","details","on","the","acceptable","inputs","to","this","module","in","that","case",".","use_edges",":","(","bool",",","default=True",")","Whether","to","condition","on","aggregated","edges",".","use_nodes",":","(","bool",",","default=True",")","Whether","to","condition","on","node","attributes",".","use_globals",":","(","bool",",","default=True",")","Whether","to","condition","on","global","attributes",".","nodes_reducer",":","Reduction","to","be","used","when","aggregating","nodes",".","This","should","be","a","callable","whose","signature","matches","tf.math.unsorted_segment_sum",".","edges_reducer",":","Reduction","to","be","used","when","aggregating","edges",".","This","should","be","a","callable","whose","signature","matches","tf.math.unsorted_segment_sum",".","name",":","The","module","name",".","Raises",":","ValueError",":","When","fields","that","are","required","are","missing","."]
code: def __init__(
      self,
      global_model_fn,
      use_edges=True,
      use_nodes=True,
      use_globals=True,
      nodes_reducer=tf.math.unsorted_segment_sum,
      edges_reducer=tf.math.unsorted_segment_sum,
      name="global_block",
  ):
      """Initializes the GlobalBlock module.
  
      Args:
        global_model_fn: A callable that will be called in the variable scope of
          this GlobalBlock and should return a Sonnet module (or equivalent
          callable) to be used as the global model. The returned module should
          take a `Tensor` (of concatenated input features) and return a `Tensor`
          (the global output features). Typically, this module would input and
          output `Tensor`s of rank 2, but it may also input or output larger
          ranks. See the `_build` method documentation for more details on the
          acceptable inputs to this module in that case.
        use_edges: (bool, default=True) Whether to condition on aggregated edges.
        use_nodes: (bool, default=True) Whether to condition on node attributes.
        use_globals: (bool, default=True) Whether to condition on global
          attributes.
        nodes_reducer: Reduction to be used when aggregating nodes. This should
          be a callable whose signature matches tf.math.unsorted_segment_sum.
        edges_reducer: Reduction to be used when aggregating edges. This should
          be a callable whose signature matches tf.math.unsorted_segment_sum.
        name: The module name.
  
      Raises:
        ValueError: When fields that are required are missing.
      """
  
      super(GlobalBlock, self).__init__(name=name)
  
      if not (use_nodes or use_edges or use_globals):
          raise ValueError(
              "At least one of use_edges, "
              "use_nodes or use_globals must be True."
          )
  
      self._use_edges = use_edges
      self._use_nodes = use_nodes
      self._use_globals = use_globals
  
      with self._enter_variable_scope():
          self._global_model = global_model_fn()
          if self._use_edges:
              if edges_reducer is None:
                  raise ValueError(
                      "If `use_edges==True`, `edges_reducer` should not be None."
                  )
              self._edges_aggregator = EdgesToGlobalsAggregator(
                  edges_reducer
              )
          if self._use_nodes:
              if nodes_reducer is None:
                  raise ValueError(
                      "If `use_nodes==True`, `nodes_reducer` should not be None."
                  )
              self._nodes_aggregator = NodesToGlobalsAggregator(
                  nodes_reducer
              )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from graph_nets import _base
  from graph_nets import graphs
  from graph_nets import utils_tf
  import tensorflow
label_desc: Use image node_id 1 to create a new GlobalBlock object from inherited base classes: _base with example: obj = GlobalBlock(global_model_fn, use_edges, use_nodes, use_globals, nodes_reducer, edges_reducer, name)