Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ogb/io/read_graph_pyg.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions ogbg-code/model/dagnn.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions src/utils_dag.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down