tf.GraphConvolutionLayer module

tf.GraphConvolutionLayer module

class tf.GraphConvolutionLayer.GraphConvolutionLayer(*args: Any, **kwargs: Any)

Bases: modelzoo.common.layers.tf.BaseLayer.BaseLayer

Implementation of Cerebras layer for GraphConvolution.

Reference:

Note: One difference from the Kipf & Welling paper is that this class applies the activation function before the adjacency matrix multiplication. This class provides the pre_activation parameter to enable the activation function before or after the adjacency multiplication. If set to False, the layer applies activation after adjacency multiplication.

Parameters
  • in_dim (int) – Input dimension of the convolution.

  • out_dim (int) – Output dimension of the convolution.

  • activation (callable) – Keras Activation to use.

  • pre_activation (bool) – Specifies whether to apply the activation before adjacency multiplication. Defaults to True.

  • use_bias (bool) – Specifies whether to add bias in the training. Defaults to True.

  • use_film (bool) – Specifies whether to use FiLM in the training. Defaults to False.

  • normalize (bool) – Specifies whether to apply the layer normalization directly after adjacency multiplication. Defaults to False.

  • layer_norm_epsilon (float) – Epsilon value for the layer normalization. Defaults to 1.0e-5.

  • kernel_initializer (str) – Keras kernel initializer to use. Defaults to "glorot_uniform".

  • bias_initializer (str) – Kernel bias initializer to use. Defaults to "zeros".

  • boundary_casting (bool) – See the documentation for BaseLayer.

  • tf_summary – See documentation for BaseLayer.

  • **kwargs – Additional keyword arguments for BaseLayer.

build(input_shape)
call(inputs, training=True, **kwargs)

Apply graph convolution to the inputs.

Parameters
  • inputs (tuple) – Contains the feature matrix of the shape [batch_size, num_nodes, in_dim] and the adjacency matrix of the shape [batch_size, num_nodes, num_nodes].

  • **kwargs – Additional keyword arguments for the call argument.

Returns

Graph Convolution layer output of shape [batch_size, num_nodes, out_dim].