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

Function _test_edge_ids

tests/python/common/test_heterograph.py:672–708  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

670
671
672def _test_edge_ids():
673 N1 = 1 << 50 # should crash if allocated a CSR
674 N2 = 1 << 48
675
676 g = dgl.heterograph(
677 {
678 ("user", "follows", "user"): (
679 F.tensor([0], F.int64),
680 F.tensor([1], F.int64),
681 ),
682 ("user", "plays", "game"): (
683 F.tensor([0], F.int64),
684 F.tensor([N2], F.int64),
685 ),
686 },
687 {"user": N1, "game": N1},
688 )
689 with pytest.raises(DGLError):
690 eid = g.edge_ids(0, 0, etype="follows")
691
692 g2 = dgl.heterograph(
693 {
694 ("user", "follows", "user"): (
695 F.tensor([0, 0], F.int64),
696 F.tensor([1, 1], F.int64),
697 ),
698 ("user", "plays", "game"): (
699 F.tensor([0], F.int64),
700 F.tensor([N2], F.int64),
701 ),
702 },
703 {"user": N1, "game": N1},
704 device=F.cpu(),
705 )
706
707 eid = g2.edge_ids(0, 1, etype="follows")
708 assert eid == 0
709
710
711@pytest.mark.skipif(

Callers

nothing calls this directly

Calls 2

edge_idsMethod · 0.45
cpuMethod · 0.45

Tested by

no test coverage detected