-
Notifications
You must be signed in to change notification settings - Fork 629
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
auto graph placement #65
Conversation
…to auto-placement
server/visualdl/graph.py
Outdated
|
||
# init all nodes | ||
for idx in range(len(nodes)): | ||
node_links[idx] = {'input': set(), 'output': set()} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
为啥不直接初始化成 list 而是用了 set,然后再变成 list? 是为了避免重复吗? 会有重复吗?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change to list()
server/visualdl/graph.py
Outdated
for in_idx in node_links[idx]['input']: | ||
in_level = node_links[in_idx]['level'] | ||
assert in_level is not None | ||
if cur_level is None or in_level >= cur_level: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里建议用 BFS, 否则如果node的顺序不对,会有bug,比如:
node_0(level 2) -> node_1
node_2(level 3) -> node_0
这样 node_1 会被更新成 3, 但实际应该是4, 因为在node_1 更新后, node_0被再次更新
当然,如果node顺序一定是从小到大的,这么写也没问题。但是BFS更保险。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
目前node一定是有序的,所以暂时没问题,这个地方目前只做了个基本实现,还需要优化
server/visualdl/graph.py
Outdated
if in_name in nodes[node_idx]['input']: | ||
node_level = node_links[node_idx]['level'] | ||
in_level = node_level - 1 | ||
if in_idx not in input_to_level: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里究竟是要得到什么呢? 是给一个 input,找到它对应的最低level? 如果 input 都是 node,是否可以利用以前的结论直接得到?而不用这么再做一遍?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
确实是想找到input的最低level,目前input不是node,input比较特殊,没有input,是别的node的input
auto graph placement
auto graph placement
No description provided.