Computes a scalar score for each edge of the given graph. Parameters ---------- edges : Has three members ``src``, ``dst`` and ``data``, each of which is a dictionary representing the features of the source nodes, the destination
(self, edges)
| 237 | self.W2 = nn.Linear(h_feats, 1) |
| 238 | |
| 239 | def apply_edges(self, edges): |
| 240 | """ |
| 241 | Computes a scalar score for each edge of the given graph. |
| 242 | |
| 243 | Parameters |
| 244 | ---------- |
| 245 | edges : |
| 246 | Has three members ``src``, ``dst`` and ``data``, each of |
| 247 | which is a dictionary representing the features of the |
| 248 | source nodes, the destination nodes, and the edges |
| 249 | themselves. |
| 250 | |
| 251 | Returns |
| 252 | ------- |
| 253 | dict |
| 254 | A dictionary of new edge features. |
| 255 | """ |
| 256 | h = torch.cat([edges.src["h"], edges.dst["h"]], 1) |
| 257 | return {"score": self.W2(F.relu(self.W1(h))).squeeze(1)} |
| 258 | |
| 259 | def forward(self, g, h): |
| 260 | with g.local_scope(): |
no outgoing calls