| 28 | |
| 29 | |
| 30 | class SIGN(nn.Module): |
| 31 | def __init__(self, in_size, out_size, r, hidden_size=256): |
| 32 | super().__init__() |
| 33 | # Note that theta and omega refer to the learnable matrices in the |
| 34 | # original paper correspondingly. The variable r refers to subscript to |
| 35 | # theta. |
| 36 | self.theta = nn.ModuleList( |
| 37 | [nn.Linear(in_size, hidden_size) for _ in range(r + 1)] |
| 38 | ) |
| 39 | self.omega = nn.Linear(hidden_size * (r + 1), out_size) |
| 40 | |
| 41 | def forward(self, X_sign): |
| 42 | results = [] |
| 43 | for i in range(len(X_sign)): |
| 44 | results.append(self.theta[i](X_sign[i])) |
| 45 | Z = F.relu(torch.cat(results, dim=1)) |
| 46 | return self.omega(Z) |
| 47 | |
| 48 | |
| 49 | def evaluate(g, pred): |