nip.utils.torch.PairInvariantizer#

class nip.utils.torch.PairInvariantizer(pair_dim: int = 0)[source]#

Transform the input to be invariant to the order of the graphs in a pair.

Works by taking the mean of the pair and half the absolute difference between the graphs.

Parameters:

pair_dim (int, default=0) – The graph pair dimension.

Methods Summary

__init__([pair_dim])

Initialize internal Module state, shared by both nn.Module and ScriptModule.

forward(x)

Transform the input to be invariant to the order of the graphs in a pair.

Attributes

T_destination

call_super_init

dump_patches

training

Methods

__init__(pair_dim: int = 0)[source]#

Initialize internal Module state, shared by both nn.Module and ScriptModule.

forward(x: Tensor) Tensor[source]#

Transform the input to be invariant to the order of the graphs in a pair.

Parameters:

x (Tensor) – The input tensor.

Returns:

transformed_x (Tensor) – The input tensor transformed to be invariant to the order of the graphs in a pair