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

Method forward

tests/python/pytorch/nn/test_nn.py:1605–1620  ·  view source on GitHub ↗
(self, graph, feat, eweight=None)

Source from the content-addressed store, hash-verified

1603 self.pool = None
1604
1605 def forward(self, graph, feat, eweight=None):
1606 with graph.local_scope():
1607 feat = self.linear(feat)
1608 graph.ndata["h"] = feat
1609 if eweight is None:
1610 graph.update_all(fn.copy_u("h", "m"), fn.sum("m", "h"))
1611 else:
1612 graph.edata["w"] = eweight
1613 graph.update_all(
1614 fn.u_mul_e("h", "w", "m"), fn.sum("m", "h")
1615 )
1616
1617 if self.pool:
1618 return self.pool(graph, graph.ndata["h"])
1619 else:
1620 return graph.ndata["h"]
1621
1622 # Explain node prediction
1623 model = Model(5, out_dim)

Callers

nothing calls this directly

Calls 6

local_scopeMethod · 0.80
update_allMethod · 0.80
multi_update_allMethod · 0.80
joinMethod · 0.45
num_nodesMethod · 0.45
itemsMethod · 0.45

Tested by

no test coverage detected