-
Notifications
You must be signed in to change notification settings - Fork 756
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
better repr of nn.Graph for debug #5762
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…com/Oneflow-Inc/oneflow into fea/nn_graph/in_out_and_sbp_in_repr
…fea/nn_graph/in_out_and_sbp_in_repr
…com/Oneflow-Inc/oneflow into fea/nn_graph/in_out_and_sbp_in_repr
chengtbf
approved these changes
Aug 6, 2021
CI failed, removing label automerge |
…-Inc/oneflow into fea/nn_graph/in_out_and_sbp_in_repr
Speed stats:
|
Speed stats:
|
chengtbf
reviewed
Aug 9, 2021
+ "-input_" | ||
+ str(idx) | ||
+ ":" | ||
+ arg._meta_repr() |
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.
这里没有处理 arg 为 None 的情形,或者不是 Tensor 的情形
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
支持graph构图时Module + Tensor层的debug
输入、输出tensor,尤其是consistent tensor的sbp和placement信息,对于执行方式影响大,但是又隐含在tensor中,这里便于debug graph。
print(tensor._meta_repr())
nn.Graph打印时不关注tensor的具体数据,只显示meta信息,所以提供内置的 meta_repr 供nn.Graph和内部使用
print(repr(graph) )或者 print(graph)
在实例化了graph,但没有执行graph前打印
这时没有input、output信息,只有module的结构信息
打开graph的debug,边构图,边打印
因为很多时候图没有构完就挂了,这样可以看挂掉之前的repr情况。
graph.debug()
打开这个开关graph.debug(False)
关闭这个开关在执行一次graph后打印
graph、block、module的_shallow_repr()
无递归子模块的repr,为了边执行边debug,因为很多时候图没有构完就挂了。