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

Function create_test_heterograph3

tests/python/common/transforms/test_transform.py:36–64  ·  view source on GitHub ↗
(idtype)

Source from the content-addressed store, hash-verified

34
35
36def create_test_heterograph3(idtype):
37 g = dgl.heterograph(
38 {
39 ("user", "plays", "game"): (
40 F.tensor([0, 1, 1, 2], dtype=idtype),
41 F.tensor([0, 0, 1, 1], dtype=idtype),
42 ),
43 ("developer", "develops", "game"): (
44 F.tensor([0, 1], dtype=idtype),
45 F.tensor([0, 1], dtype=idtype),
46 ),
47 },
48 idtype=idtype,
49 device=F.ctx(),
50 )
51
52 g.nodes["user"].data["h"] = F.copy_to(
53 F.tensor([1, 1, 1], dtype=idtype), ctx=F.ctx()
54 )
55 g.nodes["game"].data["h"] = F.copy_to(
56 F.tensor([2, 2], dtype=idtype), ctx=F.ctx()
57 )
58 g.nodes["developer"].data["h"] = F.copy_to(
59 F.tensor([3, 3], dtype=idtype), ctx=F.ctx()
60 )
61 g.edges["plays"].data["h"] = F.copy_to(
62 F.tensor([1, 1, 1, 1], dtype=idtype), ctx=F.ctx()
63 )
64 return g
65
66
67def create_test_heterograph4(idtype):

Callers 4

test_add_edgesFunction · 0.70
test_add_nodesFunction · 0.70
test_remove_edgesFunction · 0.70
test_remove_nodesFunction · 0.70

Calls 2

ctxMethod · 0.45
copy_toMethod · 0.45

Tested by

no test coverage detected