lignn
LocalLogicLoss
Bases: MessagePassing
Loss function for determining whether each node is connected to the correct number of trail edges
Source code in src/torch_structure/message_passing/lignn.py
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | |
forward(x, edge_index, y, device)
Compute the local trail-connectivity loss.
Sums each node's neighbour features and compares the resulting
trail-edge count channel against the target y.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Tensor[N, C]
|
per-node feature/probability channels. |
required |
edge_index
|
Tensor[2, E]
|
edge connectivity. |
required |
y
|
Tensor[N]
|
target trail-edge count per node. |
required |
device
|
unused, kept for interface consistency. |
required |
Returns:
| Type | Description |
|---|---|
|
torch.Tensor: the mean squared error loss. |
Source code in src/torch_structure/message_passing/lignn.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | |
message(x)
Pass each neighbour's features through unchanged, to be summed.
Source code in src/torch_structure/message_passing/lignn.py
33 34 35 | |
WeightedMax
Bases: MessagePassing
Takes the weighted max of all nodes in the neighborhood by multiplying node embeddings with edge weights
Source code in src/torch_structure/message_passing/lignn.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | |
forward(x, edge_index, weight)
Take the weighted elementwise max over each node's neighborhood.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Tensor[N, C]
|
per-node features. |
required |
edge_index
|
Tensor[2, E]
|
edge connectivity. |
required |
weight
|
Tensor[E]
|
per-edge weight applied to the source node's features before the max. |
required |
Returns:
| Type | Description |
|---|---|
|
torch.Tensor [N, C]: the aggregated features. |
Source code in src/torch_structure/message_passing/lignn.py
44 45 46 47 48 49 50 51 52 53 54 55 56 57 | |
message(x_i, x_j, weight)
Return the elementwise max of the target's features and the weighted source features.
Source code in src/torch_structure/message_passing/lignn.py
59 60 61 | |