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

Function create_test_heterograph4

tests/python/common/test_heterograph.py:117–144  ·  view source on GitHub ↗
(idtype)

Source from the content-addressed store, hash-verified

115
116
117def create_test_heterograph4(idtype):
118 g = dgl.heterograph(
119 {
120 ("user", "follows", "user"): (
121 F.tensor([0, 1, 1, 2, 2, 2], dtype=idtype),
122 F.tensor([0, 0, 1, 1, 2, 2], dtype=idtype),
123 ),
124 ("user", "plays", "game"): (
125 F.tensor([0, 1], dtype=idtype),
126 F.tensor([0, 1], dtype=idtype),
127 ),
128 },
129 idtype=idtype,
130 device=F.ctx(),
131 )
132 g.nodes["user"].data["h"] = F.copy_to(
133 F.tensor([1, 1, 1], dtype=idtype), ctx=F.ctx()
134 )
135 g.nodes["game"].data["h"] = F.copy_to(
136 F.tensor([2, 2], dtype=idtype), ctx=F.ctx()
137 )
138 g.edges["follows"].data["h"] = F.copy_to(
139 F.tensor([1, 2, 3, 4, 5, 6], dtype=idtype), ctx=F.ctx()
140 )
141 g.edges["plays"].data["h"] = F.copy_to(
142 F.tensor([1, 2], dtype=idtype), ctx=F.ctx()
143 )
144 return g
145
146
147def create_test_heterograph5(idtype):

Callers

nothing calls this directly

Calls 2

ctxMethod · 0.45
copy_toMethod · 0.45

Tested by

no test coverage detected