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

Method forward

tutorials/blitz/4_link_predict.py:216–223  ·  view source on GitHub ↗
(self, g, h)

Source from the content-addressed store, hash-verified

214
215class DotPredictor(nn.Module):
216 def forward(self, g, h):
217 with g.local_scope():
218 g.ndata["h"] = h
219 # Compute a new edge feature named 'score' by a dot-product between the
220 # source node feature 'h' and destination node feature 'h'.
221 g.apply_edges(fn.u_dot_v("h", "h", "score"))
222 # u_dot_v returns a 1-element vector for each edge so you need to squeeze it.
223 return g.edata["score"][:, 0]
224
225
226######################################################################

Callers

nothing calls this directly

Calls 2

local_scopeMethod · 0.80
apply_edgesMethod · 0.45

Tested by

no test coverage detected