(idtype, dtype, return_edge_ids)
| 114 | @pytest.mark.parametrize("dtype", [F.float32, F.float64]) |
| 115 | @pytest.mark.parametrize("return_edge_ids", [True, False]) |
| 116 | def test_csrsum(idtype, dtype, return_edge_ids): |
| 117 | a, A = _random_simple_graph( |
| 118 | idtype, dtype, F.ctx(), 500, 600, 9000, "A", "B", "AB" |
| 119 | ) |
| 120 | b, B = _random_simple_graph( |
| 121 | idtype, dtype, F.ctx(), 500, 600, 9000, "A", "B", "AB" |
| 122 | ) |
| 123 | C, C_weights = dgl._sparse_ops._csrsum( |
| 124 | [A._graph, B._graph], [A.edata["w"], B.edata["w"]] |
| 125 | ) |
| 126 | C_adj = C.adjacency_matrix_scipy(0, False, "csr", return_edge_ids) |
| 127 | C_adj.data = F.asnumpy(C_weights) |
| 128 | C_adj = F.tensor(C_adj.todense(), dtype=dtype) |
| 129 | c = F.tensor((a + b).todense(), dtype=dtype) |
| 130 | assert F.allclose(C_adj, c) |
| 131 | |
| 132 | |
| 133 | @parametrize_idtype |
no test coverage detected