histocartography.ml.layers.gin_layer module

Implementation of a GIN (Graph Isomorphism Network) layer.

Original paper:

Summary

Classes:

GINLayer

class GINLayer(node_dim: int, out_dim: int, act: str = 'relu', agg_type: str = 'mean', hidden_dim: int = 32, batch_norm: bool = True, graph_norm: bool = False, with_lrp: bool = False, dropout: float = 0.0, verbose: bool = False)[source]

Bases: torch.nn.modules.module.Module

__init__(node_dim: int, out_dim: int, act: str = 'relu', agg_type: str = 'mean', hidden_dim: int = 32, batch_norm: bool = True, graph_norm: bool = False, with_lrp: bool = False, dropout: float = 0.0, verbose: bool = False)None[source]

GIN Layer constructor

Parameters
  • node_dim (int) – Input dimension of each node.

  • out_dim (int) – Output dimension of each node.

  • act (str) – Activation function of the update function.

  • agg_type (str) – Aggregation function. Default to ‘mean’.

  • hidden_dim (int) – Hidden dimension of the GIN MLP. Default to 32.

  • batch_norm (bool) – If we should use batch normalization. Default to True.

  • graph_norm (bool) – If we should use graph normalization. Default to False.

  • with_lrp (bool) – If we should use LRP. Default to False.

  • dropout (float) – If we should use dropout. Default to 0.

  • verbose (bool) – Verbosity. Default to False.

reduce_fn(nodes)[source]

For each node, aggregate the nodes using a reduce function. Current supported functions are sum and mean.

msg_fn(edges)[source]

Message of each node

node_update_fn(nodes)[source]

Node update function

forward(g, h)[source]

Forward-pass of a GIN layer. :param g: (DGLGraph) graph to process. :param h: (FloatTensor) node features

set_lrp(with_lrp)[source]
lrp(out_relevance_score)[source]

Implement lrp for GIN layer

Reference

If you use histocartography in your projects, please cite the following:

@inproceedings{pati2021,
    title = {Hierarchical Graph Representations for Digital Pathology},
    author = {Pushpak Pati, Guillaume Jaume, Antonio Foncubierta, Florinda Feroce, Anna Maria Anniciello, Giosuè Scognamiglio, Nadia Brancati, Maryse Fiche, Estelle Dubruc, Daniel Riccio, Maurizio Di Bonito, Giuseppe De Pietro, Gerardo Botti, Jean-Philippe Thiran, Maria Frucci, Orcun Goksel, Maria Gabrani},
    booktitle = {https://arxiv.org/pdf/2102.11057},
    year = {2021}
}