GOOD.networks.models.DIRGNN
The implementation of Discovering Invariant Rationales for Graph Neural Networks.
Functions
|
Adopted from https://github.com/wuyxin/dir-gnn. |
|
Adopted from https://github.com/wuyxin/dir-gnn. |
|
Adopted from https://github.com/wuyxin/dir-gnn. |
|
Adopted from https://github.com/rusty1s/pytorch_scatter/issues/48. |
|
Sparse topk calculation. |
|
Adopted from https://github.com/wuyxin/dir-gnn. |
|
Adapted from https://github.com/wuyxin/dir-gnn. |
- GOOD.networks.models.DIRGNN.clear_masks(model: Module)[source]
Adopted from https://github.com/wuyxin/dir-gnn.
- GOOD.networks.models.DIRGNN.relabel(x, edge_index, batch, pos=None)[source]
Adopted from https://github.com/wuyxin/dir-gnn.
- GOOD.networks.models.DIRGNN.set_masks(mask: Tensor, model: Module)[source]
Adopted from https://github.com/wuyxin/dir-gnn.
- GOOD.networks.models.DIRGNN.sparse_sort(src: Tensor, index: Tensor, dim=0, descending=False, eps=1e-12)[source]
Adopted from https://github.com/rusty1s/pytorch_scatter/issues/48.
- GOOD.networks.models.DIRGNN.sparse_topk(src: Tensor, index: Tensor, ratio: float, dim=0, descending=False, eps=1e-12)[source]
Sparse topk calculation.
- GOOD.networks.models.DIRGNN.split_batch(g)[source]
Adopted from https://github.com/wuyxin/dir-gnn.
- GOOD.networks.models.DIRGNN.split_graph(data, edge_score, ratio)[source]
Adapted from https://github.com/wuyxin/dir-gnn.
Classes
|
Causal Attention Network adapted from https://github.com/wuyxin/dir-gnn. |
|
|
|
The GIN virtual node version of DIR. |
|
The GIN virtual node without batchnorm version of DIR. |
- class GOOD.networks.models.DIRGNN.CausalAttNet(causal_ratio, config, **kwargs)[source]
Bases:
Module
Causal Attention Network adapted from https://github.com/wuyxin/dir-gnn.
- forward(*args, **kwargs)[source]
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class GOOD.networks.models.DIRGNN.DIRGIN(config: Union[CommonArgs, Munch])[source]
Bases:
GNNBasic
- forward(*args, **kwargs)[source]
The DIR model implementation.
- Parameters
*args (list) – argument list for the use of arguments_read. Refer to
arguments_read
**kwargs (dict) – key word arguments for the use of arguments_read. Refer to
arguments_read
- Returns (Tensor):
Label predictions and other results for loss calculations.
- class GOOD.networks.models.DIRGNN.DIRvGIN(config: Union[CommonArgs, Munch])[source]
Bases:
DIRGIN
The GIN virtual node version of DIR.
- class GOOD.networks.models.DIRGNN.DIRvGINNB(config: Union[CommonArgs, Munch])[source]
Bases:
DIRGIN
The GIN virtual node without batchnorm version of DIR.