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

Function create_test_heterograph5

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

Source from the content-addressed store, hash-verified

145
146
147def create_test_heterograph5(idtype):
148 g = dgl.heterograph(
149 {
150 ("user", "follows", "user"): (
151 F.tensor([1, 2], dtype=idtype),
152 F.tensor([0, 1], dtype=idtype),
153 ),
154 ("user", "plays", "game"): (
155 F.tensor([0, 1], dtype=idtype),
156 F.tensor([0, 1], dtype=idtype),
157 ),
158 },
159 idtype=idtype,
160 device=F.ctx(),
161 )
162 g.nodes["user"].data["h"] = F.copy_to(
163 F.tensor([1, 1, 1], dtype=idtype), ctx=F.ctx()
164 )
165 g.nodes["game"].data["h"] = F.copy_to(
166 F.tensor([2, 2], dtype=idtype), ctx=F.ctx()
167 )
168 g.edges["follows"].data["h"] = F.copy_to(
169 F.tensor([1, 2], dtype=idtype), ctx=F.ctx()
170 )
171 g.edges["plays"].data["h"] = F.copy_to(
172 F.tensor([1, 2], dtype=idtype), ctx=F.ctx()
173 )
174 return g
175
176
177def get_redfn(name):

Callers

nothing calls this directly

Calls 2

ctxMethod · 0.45
copy_toMethod · 0.45

Tested by

no test coverage detected