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

Method __call__

python/dgl/transforms/module.py:630–650  ·  view source on GitHub ↗
(self, g)

Source from the content-addressed store, hash-verified

628 )
629
630 def __call__(self, g):
631 for c_etype in g.canonical_etypes:
632 g = self.transform_etype(c_etype, g)
633
634 if self.new_etypes:
635 device = g.device
636 idtype = g.idtype
637 data_dict = dict()
638
639 # Add self etypes
640 for ntype in g.ntypes:
641 nids = F.arange(0, g.num_nodes(ntype), idtype, device)
642 data_dict[(ntype, "self", ntype)] = (nids, nids)
643
644 # Copy edges
645 for c_etype in g.canonical_etypes:
646 data_dict[c_etype] = g.edges(etype=c_etype)
647
648 g = update_graph_structure(g, data_dict)
649
650 return g
651
652
653class RemoveSelfLoop(BaseTransform):

Callers

nothing calls this directly

Calls 4

transform_etypeMethod · 0.95
update_graph_structureFunction · 0.85
num_nodesMethod · 0.45
edgesMethod · 0.45

Tested by

no test coverage detected