From 8b295ef56e126e0cac22c7d34a2ff64eb0ef0db4 Mon Sep 17 00:00:00 2001 From: LUOyk1999 <57895481+LUOyk1999@users.noreply.github.com> Date: Wed, 31 Aug 2022 11:55:23 +0800 Subject: [PATCH] torch==1.12.1+cu116, torch-geometric==2.0.4. --- ogb/io/read_graph_pyg.py | 2 +- ogbg-code/model/dagnn.py | 4 ++-- src/utils_dag.py | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/ogb/io/read_graph_pyg.py b/ogb/io/read_graph_pyg.py index ff61b8f..2f80cde 100644 --- a/ogb/io/read_graph_pyg.py +++ b/ogb/io/read_graph_pyg.py @@ -51,7 +51,7 @@ def read_graph_pyg(raw_dir, add_inverse_edge = False, additional_node_files = [] add_order_info_01(g) # DAGNN # length of longest path # layer ids start with 0 so max, gives actual path length and -1 is not necessary - g.len_longest_path = float(torch.max(g._bi_layer_idx0).item()) + g.len_longest_path = float(torch.max(g.bi_layer_idx0).item()) return pyg_graph_list diff --git a/ogbg-code/model/dagnn.py b/ogbg-code/model/dagnn.py index 9d505df..1cbca2e 100644 --- a/ogbg-code/model/dagnn.py +++ b/ogbg-code/model/dagnn.py @@ -128,8 +128,8 @@ def _get_output_nodes(self, G, reverse=0): def forward(self, G): # need to create these here since pyg's batching otherwise messes up the indices G.bi_layer_index = torch.stack([ - torch.stack([G._bi_layer_idx0, G._bi_layer_index0], dim=0), - torch.stack([G._bi_layer_idx1, G._bi_layer_index1], dim=0) + torch.stack([G.bi_layer_idx0, G.bi_layer_index0], dim=0), + torch.stack([G.bi_layer_idx1, G.bi_layer_index1], dim=0) ], dim=0) device = G.x.device diff --git a/src/utils_dag.py b/src/utils_dag.py index 94c074d..271ec5c 100644 --- a/src/utils_dag.py +++ b/src/utils_dag.py @@ -43,10 +43,10 @@ def add_order_info_01(graph): l1 = top_sort(ei2, graph.num_nodes) ns = torch.LongTensor([i for i in range(graph.num_nodes)]) - graph.__setattr__("_bi_layer_idx0", l0) - graph.__setattr__("_bi_layer_index0", ns) - graph.__setattr__("_bi_layer_idx1", l1) - graph.__setattr__("_bi_layer_index1", ns) + graph.__setattr__("bi_layer_idx0", l0) + graph.__setattr__("bi_layer_index0", ns) + graph.__setattr__("bi_layer_idx1", l1) + graph.__setattr__("bi_layer_index1", ns) assert_order(graph.edge_index, l0, ns) assert_order(ei2, l1, ns)