MCPcopy
hub / github.com/dmlc/dgl / apply_edges

Method apply_edges

tutorials/blitz/4_link_predict.py:239–257  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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():

Callers 12

forwardMethod · 0.45
_testFunction · 0.45
test_applyFunction · 0.45
test_types_in_functionFunction · 0.45
test_sddmmFunction · 0.45
test_apply_edgesFunction · 0.45
fooFunction · 0.45
forwardMethod · 0.45
forwardMethod · 0.45
forwardMethod · 0.45
forwardMethod · 0.45

Calls

no outgoing calls

Tested by 9

forwardMethod · 0.36
_testFunction · 0.36
test_applyFunction · 0.36
test_types_in_functionFunction · 0.36
test_sddmmFunction · 0.36
test_apply_edgesFunction · 0.36
fooFunction · 0.36
forwardMethod · 0.36