class_docstr: A stack of :class:`.GraphConvolution` layers together with a Keras `GlobalAveragePooling1D` layer (by default)
  that implement a supervised graph classification network using the GCN convolution operator
  (https://arxiv.org/abs/1609.02907).
  
  The model minimally requires specification of the GCN layer sizes as a list of int
  corresponding to the feature dimensions for each hidden layer,
  activation functions for each hidden layers, and a generator object.
  
  To use this class as a Keras model, the features and preprocessed adjacency matrix
  should be supplied using the :class:`.PaddedGraphGenerator` class.
  
  Examples:
      Creating a graph classification model from a list of :class:`.StellarGraph`
      objects (``graphs``). We also add two fully connected dense layers using the last one for binary classification
      with `softmax` activation::
  
          generator = PaddedGraphGenerator(graphs)
          model = GCNSupervisedGraphClassification(
                           layer_sizes=[32, 32],
                           activations=["elu","elu"],
                           generator=generator,
                           dropout=0.5
              )
          x_inp, x_out = model.in_out_tensors()
          predictions = Dense(units=8, activation='relu')(x_out)
          predictions = Dense(units=2, activation='softmax')(predictions)
  
  .. seealso::
  
     Examples using GCN graph classification:
  
     - `graph classification <https://stellargraph.readthedocs.io/en/stable/demos/graph-classification/gcn-supervised-graph-classification.html>`__
     - `unsupervised representation learning <https://stellargraph.readthedocs.io/en/stable/demos/embeddings/gcn-unsupervised-graph-embeddings.html>`__
  
     Appropriate data generator: :class:`.PaddedGraphGenerator`.
  
     Related models:
  
     - :class:`.DeepGraphCNN` for a specialisation using :class:`.SortPooling`
     - :class:`.GCN` for predictions for individual nodes or links
  
  Args:
      layer_sizes (list of int): list of output sizes of the graph GCN layers in the stack.
      activations (list of str): list of activations applied to each GCN layer's output.
      generator (PaddedGraphGenerator): an instance of :class:`.PaddedGraphGenerator` class constructed on the graphs used for
          training.
      bias (bool, optional): toggles an optional bias in graph convolutional layers.
      dropout (float, optional): dropout rate applied to input features of each GCN layer.
  
      pooling (callable, optional): a Keras layer or function that takes two arguments and returns
          a tensor representing the embeddings for each graph in the batch. Arguments:
  
          - embeddings tensor argument with shape ``batch size × nodes × output size``, where
            ``nodes`` is the maximum number of nodes of a graph in the batch and ``output size``
            is the size of the final graph convolutional layer, or, if ``pool_all_layers``, the
            sum of the sizes of each graph convolutional layers.
          - ``mask`` tensor named argument of booleans with shape ``batch size × nodes``. ``True``
            values indicate which rows of the embeddings argument are valid, and all other rows
            (corresponding to ``mask == False``) must be ignored.
  
          The returned tensor can have any shape ``batch size``, ``batch size × N1``, ``batch size
          × N1 × N2``, ..., as long as the ``N1``, ``N2``, ... are constant across all graphs:
          they must not depend on the ``nodes`` dimension or on the number of ``True`` values in
          ``mask``. ``pooling`` defaults to mean pooling via ``GlobalAveragePooling1D``.
  
      pool_all_layers (bool, optional): which layers to pass to the pooling method: if ``True``,
          pass the concatenation of the output of every GCN layer, otherwise pass only the output
          of the last GCN layer.
      kernel_initializer (str or func, optional): The initialiser to use for the weights of each graph
          convolutional layer.
      kernel_regularizer (str or func, optional): The regulariser to use for the weights of each graph
          convolutional layer.
      kernel_constraint (str or func, optional): The constraint to use for the weights of each layer graph
          convolutional.
      bias_initializer (str or func, optional): The initialiser to use for the bias of each layer graph
          convolutional.
      bias_regularizer (str or func, optional): The regulariser to use for the bias of each layer graph
          convolutional.
      bias_constraint (str or func, optional): The constraint to use for the bias of each layer graph
          convolutional.
docstr: Apply a stack of :class:`.GraphConvolution` layers to the inputs.
  The input tensors are expected to be a list of the following:
  [
      Node features shape (batch size, N, F),
      Mask (batch size, N ),
      Adjacency matrices (batch size, N, N),
  ]
  where N is the number of nodes and F the number of input features
  
  Args:
      x (Tensor): input tensors
  
  Returns:
      Output tensor
docstr_tok: ["Apply","a","stack","of",":","class",":","`",".GraphConvolution","`","layers","to","the","inputs",".","The","input","tensors","are","expected","to","be","a","list","of","the","following",":","[","Node","features","shape","(","batch","size",",","N",",","F",")",",","Mask","(","batch","size",",","N",")",",","Adjacency","matrices","(","batch","size",",","N",",","N",")",",","]","where","N","is","the","number","of","nodes","and","F","the","number","of","input","features","Args",":","x","(","Tensor",")",":","input","tensors","Returns",":","Output","tensor"]
code: def __call__(self, x):
      """
      Apply a stack of :class:`.GraphConvolution` layers to the inputs.
      The input tensors are expected to be a list of the following:
      [
          Node features shape (batch size, N, F),
          Mask (batch size, N ),
          Adjacency matrices (batch size, N, N),
      ]
      where N is the number of nodes and F the number of input features
  
      Args:
          x (Tensor): input tensors
  
      Returns:
          Output tensor
      """
      x_in, mask, As = x
      h_layer = x_in
  
      gcn_layers = []
  
      for layer in self._layers:
          if isinstance(layer, GraphConvolution):
              h_layer = layer([h_layer, As])
              gcn_layers.append(h_layer)
          else:
              # For other (non-graph) layers only supply the input tensor
              h_layer = layer(h_layer)
  
      if self.pool_all_layers:
          h_layer = tf.concat(gcn_layers, axis=-1)
  
      # mask to ignore the padded values
      h_layer = self.pooling(h_layer, mask=mask)
  
      return h_layer
  
file_path: stellargraph/stellargraph/layer/graph_classification.py
imports: import tensorflow
  from tensorflow.keras import backend
  from .misc import deprecated_model_function
  from ..mapper import PaddedGraphGenerator
  from .gcn import GraphConvolution
  from .sort_pooling import SortPooling
  from tensorflow.keras.layers import Input, Dropout, GlobalAveragePooling1D
label_desc: Use image node_id 2 for calling the GCNSupervisedGraphClassification obj's underlying member method code with example usage: obj.__call__(x) and returns: h_layer