From 6ae08385301ee52acc4829b54c294f91d8cc761f Mon Sep 17 00:00:00 2001 From: chenjian Date: Tue, 4 Apr 2023 14:03:39 +0800 Subject: [PATCH] [Bug] Fix export graph bug in windows (#1244) * fix export graph bug in windows * fix format --- visualdl/component/graph/graph_component.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/visualdl/component/graph/graph_component.py b/visualdl/component/graph/graph_component.py index 428972d5..be71a12b 100644 --- a/visualdl/component/graph/graph_component.py +++ b/visualdl/component/graph/graph_component.py @@ -14,6 +14,7 @@ # ======================================================================= import collections import os.path +import pathlib import re _graph_version = '1.0.0' @@ -108,6 +109,8 @@ def construct_edges(var_name, all_ops, all_vars, all_edges): all_edges[(src_node, dst_node)]['vars'].add(var_name) else: common_ancestor = os.path.commonpath([src_node, dst_node]) + common_ancestor = pathlib.Path(common_ancestor).as_posix( + ) # in windows, os.path.commonpath will return windows path, we should convert it to posix src_base_node = src_node while True: parent_node = all_ops[src_base_node]['parent_node'] -- GitLab