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

Function test_uva_subgraph

tests/python/common/test_subgraph.py:838–852  ·  view source on GitHub ↗
(idtype, device)

Source from the content-addressed store, hash-verified

836@pytest.mark.parametrize("device", [F.cpu(), F.cuda()])
837@parametrize_idtype
838def test_uva_subgraph(idtype, device):
839 g = create_test_heterograph2(idtype)
840 g = g.to(F.cpu())
841 g.create_formats_()
842 g.pin_memory_()
843 indices = {"user": F.copy_to(F.tensor([0], idtype), device)}
844 edge_indices = {"follows": F.copy_to(F.tensor([0], idtype), device)}
845 assert g.subgraph(indices).device == device
846 assert g.edge_subgraph(edge_indices).device == device
847 assert g.in_subgraph(indices).device == device
848 assert g.out_subgraph(indices).device == device
849 assert g.khop_in_subgraph(indices, 1)[0].device == device
850 assert g.khop_out_subgraph(indices, 1)[0].device == device
851 assert g.sample_neighbors(indices, 1).device == device
852 g.unpin_memory_()
853
854
855if __name__ == "__main__":

Callers 1

test_subgraph.pyFile · 0.85

Calls 10

in_subgraphMethod · 0.80
create_test_heterograph2Function · 0.70
toMethod · 0.45
cpuMethod · 0.45
create_formats_Method · 0.45
pin_memory_Method · 0.45
copy_toMethod · 0.45
edge_subgraphMethod · 0.45
sample_neighborsMethod · 0.45
unpin_memory_Method · 0.45

Tested by

no test coverage detected