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)