phlower.nn.GCNΒΆ

class phlower.nn.GCN(nodes, support_name, activations=None, dropouts=None, repeat=1, factor=1.0, bias=True)[source]ΒΆ

Bases: IPhlowerCoreModule, Module

GCN is a neural network module that performs a graph convolution operation on the input tensor.

Parameters:
  • nodes (list[int]) – List of feature dimension sizes (The last value of tensor shape).

  • support_name (str) – Name of the support tensor.

  • activations (list[str] | None (optional)) – List of activation functions to apply to the output. Defaults to None.

  • dropouts (list[float] | None (optional)) – List of dropout rates to apply to the output. Defaults to None.

  • repeat (int) – Number of times to repeat the operation.

  • factor (float) – Factor to multiply the support tensor by.

  • bias (bool) – Whether to use bias.

Examples

>>> gcn = GCN(
...     nodes=[10, 20, 30],
...     support_name="support",
...     activations=["relu", "relu", "relu"],
...     dropouts=[0.1, 0.1, 0.1],
...     repeat=1,
...     factor=1.0,
...     bias=True
...)
>>> gcn(data)

Methods

forward(data, *, field_data, **kwards)

forward function which overload torch.nn.Module

from_setting(setting)

Create GCN from GCNSetting instance

get_nn_name()

Return neural network name

Attributes

T_destination

call_super_init

dump_patches

training

forward(data, *, field_data, **kwards)[source]ΒΆ

forward function which overload torch.nn.Module

Parameters:
  • data (IPhlowerTensorCollections) – IPhlowerTensorCollections data which receives from predecessors

  • field_data (ISimulationField) – ISimulationField | None Constant information through training or prediction

Returns:

Tensor object

Return type:

PhlowerTensor

classmethod from_setting(setting)[source]ΒΆ

Create GCN from GCNSetting instance

Parameters:

setting (GCNSetting) – setting object for GCN

Returns:

GCN object

Return type:

GCN

classmethod get_nn_name()[source]ΒΆ

Return neural network name

Returns:

name

Return type:

str