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

Function test_more_nnz

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

Source from the content-addressed store, hash-verified

1983 F._default_context_str == "cpu", reason="Need gpu for this test"
1984)
1985def test_more_nnz(idtype):
1986 g = dgl.graph(
1987 ([0, 0, 0, 0, 0], [1, 1, 1, 1, 1]), idtype=idtype, device=F.ctx()
1988 )
1989 g.ndata["x"] = F.copy_to(F.ones((2, 5)), ctx=F.ctx())
1990 g.update_all(fn.copy_u("x", "m"), fn.sum("m", "y"))
1991 y = g.ndata["y"]
1992 ans = np.zeros((2, 5))
1993 ans[1] = 5
1994 ans = F.copy_to(F.tensor(ans, dtype=F.dtype(y)), ctx=F.ctx())
1995 assert F.array_equal(y, ans)
1996
1997
1998@parametrize_idtype

Callers

nothing calls this directly

Calls 5

update_allMethod · 0.80
graphMethod · 0.45
ctxMethod · 0.45
copy_toMethod · 0.45
dtypeMethod · 0.45

Tested by

no test coverage detected