class_docstr: Relational Graph Convolution (RGCN) Keras layer.
  
  Original paper: Modeling Relational Data with Graph Convolutional Networks.
  Thomas N. Kipf, Michael Schlichtkrull (2017). https://arxiv.org/pdf/1703.06103.pdf
  
  Notes:
    - The inputs are tensors with a batch dimension of 1:
      Keras requires this batch dimension, and for full-batch methods
      we only have a single "batch".
  
    - There are 1 + R inputs required (where R is the number of relationships): the node features,
      and a normalized adjacency matrix for each relationship
  
  .. seealso:: :class:`.RGCN` combines several of these layers.
  
  Args:
      units (int): dimensionality of output feature vectors
      num_relationships (int): the number of relationships in the graph
      num_bases (int): the number of basis matrices to use for parameterizing the weight matrices as described in
          the paper; defaults to 0. ``num_bases < 0`` triggers the default behaviour of ``num_bases = 0``
      activation (str or func): nonlinear activation applied to layer's output to obtain output features
      use_bias (bool): toggles an optional bias
      final_layer (bool): Deprecated, use ``tf.gather`` or :class:`.GatherIndices`
      kernel_initializer (str or func): The initialiser to use for the self kernel and also relational kernels if ``num_bases=0``.
      kernel_regularizer (str or func): The regulariser to use for the self kernel and also relational kernels if ``num_bases=0``.
      kernel_constraint (str or func): The constraint to use for the self kernel and also relational kernels if ``num_bases=0``.
      basis_initializer (str or func): The initialiser to use for the basis matrices.
      basis_regularizer (str or func): The regulariser to use for the basis matrices.
      basis_constraint (str or func): The constraint to use for the basis matrices.
      coefficient_initializer (str or func): The initialiser to use for the coefficients.
      coefficient_regularizer (str or func): The regulariser to use for the coefficients.
      coefficient_constraint (str or func): The constraint to use for the coefficients.
      bias_initializer (str or func): The initialiser to use for the bias.
      bias_regularizer (str or func): The regulariser to use for the bias.
      bias_constraint (str or func): The constraint to use for the bias.
      input_dim (int, optional): the size of the input shape, if known.
      kwargs: any additional arguments to pass to :class:`tensorflow.keras.layers.Layer`
class_docstr_tok: ["Relational","Graph","Convolution","(","RGCN",")","Keras","layer",".","Original","paper",":","Modeling","Relational","Data","with","Graph","Convolutional","Networks",".","Thomas","N.","Kipf",",","Michael","Schlichtkrull","(","2017",")",".","https",":","\/\/arxiv.org\/pdf\/1703.06103.pdf","Notes",":","-","The","inputs","are","tensors","with","a","batch","dimension","of","1",":","Keras","requires","this","batch","dimension",",","and","for","full-batch","methods","we","only","have","a","single","``","batch","''",".","-","There","are","1","+","R","inputs","required","(","where","R","is","the","number","of","relationships",")",":","the","node","features",",","and","a","normalized","adjacency","matrix","for","each","relationship","..","seealso",":",":",":","class",":","`",".RGCN","`","combines","several","of","these","layers",".","Args",":","units","(","int",")",":","dimensionality","of","output","feature","vectors","num_relationships","(","int",")",":","the","number","of","relationships","in","the","graph","num_bases","(","int",")",":","the","number","of","basis","matrices","to","use","for","parameterizing","the","weight","matrices","as","described","in","the","paper",";","defaults","to","0",".","``","num_bases","<","0","``","triggers","the","default","behaviour","of","``","num_bases","=","0","``","activation","(","str","or","func",")",":","nonlinear","activation","applied","to","layer","'s","output","to","obtain","output","features","use_bias","(","bool",")",":","toggles","an","optional","bias","final_layer","(","bool",")",":","Deprecated",",","use","``","tf.gather","``","or",":","class",":","`",".GatherIndices","`","kernel_initializer","(","str","or","func",")",":","The","initialiser","to","use","for","the","self","kernel","and","also","relational","kernels","if","``","num_bases=0","``",".","kernel_regularizer","(","str","or","func",")",":","The","regulariser","to","use","for","the","self","kernel","and","also","relational","kernels","if","``","num_bases=0","``",".","kernel_constraint","(","str","or","func",")",":","The","constraint","to","use","for","the","self","kernel","and","also","relational","kernels","if","``","num_bases=0","``",".","basis_initializer","(","str","or","func",")",":","The","initialiser","to","use","for","the","basis","matrices",".","basis_regularizer","(","str","or","func",")",":","The","regulariser","to","use","for","the","basis","matrices",".","basis_constraint","(","str","or","func",")",":","The","constraint","to","use","for","the","basis","matrices",".","coefficient_initializer","(","str","or","func",")",":","The","initialiser","to","use","for","the","coefficients",".","coefficient_regularizer","(","str","or","func",")",":","The","regulariser","to","use","for","the","coefficients",".","coefficient_constraint","(","str","or","func",")",":","The","constraint","to","use","for","the","coefficients",".","bias_initializer","(","str","or","func",")",":","The","initialiser","to","use","for","the","bias",".","bias_regularizer","(","str","or","func",")",":","The","regulariser","to","use","for","the","bias",".","bias_constraint","(","str","or","func",")",":","The","constraint","to","use","for","the","bias",".","input_dim","(","int",",","optional",")",":","the","size","of","the","input","shape",",","if","known",".","kwargs",":","any","additional","arguments","to","pass","to",":","class",":","`","tensorflow.keras.layers.Layer","`"]
docstr: Applies the layer.
  
  Args:
      inputs (list): a list of 2 + R input tensors that includes
          node features (size 1 x N x F),
          and a graph adjacency matrix (size N x N) for each relationship.
          R is the number of relationships in the graph (edge type),
          N is the number of nodes in the graph, and
          F is the dimensionality of node features.
  
  Returns:
      Keras Tensor that represents the output of the layer.
docstr_tok: ["Applies","the","layer",".","Args",":","inputs","(","list",")",":","a","list","of","2","+","R","input","tensors","that","includes","node","features","(","size","1","x","N","x","F",")",",","and","a","graph","adjacency","matrix","(","size","N","x","N",")","for","each","relationship",".","R","is","the","number","of","relationships","in","the","graph","(","edge","type",")",",","N","is","the","number","of","nodes","in","the","graph",",","and","F","is","the","dimensionality","of","node","features",".","Returns",":","Keras","Tensor","that","represents","the","output","of","the","layer","."]
code: def call(self, inputs):
      """
      Applies the layer.
  
      Args:
          inputs (list): a list of 2 + R input tensors that includes
              node features (size 1 x N x F),
              and a graph adjacency matrix (size N x N) for each relationship.
              R is the number of relationships in the graph (edge type),
              N is the number of nodes in the graph, and
              F is the dimensionality of node features.
  
      Returns:
          Keras Tensor that represents the output of the layer.
      """
      features, *As = inputs
      batch_dim, n_nodes, _ = K.int_shape(features)
      if batch_dim != 1:
          raise ValueError(
              "Currently full-batch methods only support a batch dimension of one"
          )
  
      # Remove singleton batch dimension
      features = K.squeeze(features, 0)
  
      # Calculate the layer operation of RGCN
      output = K.dot(features, self.self_kernel)
  
      if self.relational_kernels is None:
          # explicitly calculate the relational kernels if basis matrices are used
          relational_kernels = [
              tf.einsum("ijk,k->ij", self.bases, coeff)
              for coeff in self.coefficients
          ]
      else:
          relational_kernels = self.relational_kernels
  
      for i in range(self.num_relationships):
          h_graph = K.dot(As[i], features)
          output += K.dot(h_graph, relational_kernels[i])
  
      # Add optional bias & apply activation
      if self.bias is not None:
          output += self.bias
      output = self.activation(output)
  
      # Add batch dimension back if we removed it
      if batch_dim == 1:
          output = K.expand_dims(output, 0)
  
      return output
  
file_path: stellargraph/stellargraph/layer/rgcn.py
imports: import tensorflow
  from tensorflow.keras import backend
  from tensorflow.keras.layers import Layer, Lambda, Dropout, Input
  from tensorflow.keras import activations, initializers, constraints, regularizers
  from .misc import SqueezedSparseConversion, deprecated_model_function, GatherIndices
  from ..mapper.full_batch_generators import RelationalFullBatchNodeGenerator
label_desc: Use image node_id 5 for calling the RelationalGraphConvolution obj's underlying member method code with example usage: obj.call(inputs) and returns: output