MCPcopy Index your code
hub / github.com/dmlc/dgl / create_test_heterograph4

Function create_test_heterograph4

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

Source from the content-addressed store, hash-verified

65
66
67def create_test_heterograph4(idtype):
68 g = dgl.heterograph(
69 {
70 ("user", "follows", "user"): (
71 F.tensor([0, 1, 1, 2, 2, 2], dtype=idtype),
72 F.tensor([0, 0, 1, 1, 2, 2], dtype=idtype),
73 ),
74 ("user", "plays", "game"): (
75 F.tensor([0, 1], dtype=idtype),
76 F.tensor([0, 1], dtype=idtype),
77 ),
78 },
79 idtype=idtype,
80 device=F.ctx(),
81 )
82 g.nodes["user"].data["h"] = F.copy_to(
83 F.tensor([1, 1, 1], dtype=idtype), ctx=F.ctx()
84 )
85 g.nodes["game"].data["h"] = F.copy_to(
86 F.tensor([2, 2], dtype=idtype), ctx=F.ctx()
87 )
88 g.edges["follows"].data["h"] = F.copy_to(
89 F.tensor([1, 2, 3, 4, 5, 6], dtype=idtype), ctx=F.ctx()
90 )
91 g.edges["plays"].data["h"] = F.copy_to(
92 F.tensor([1, 2], dtype=idtype), ctx=F.ctx()
93 )
94 return g
95
96
97def create_test_heterograph5(idtype):

Callers 1

test_remove_selfloopFunction · 0.70

Calls 2

ctxMethod · 0.45
copy_toMethod · 0.45

Tested by

no test coverage detected