-
Notifications
You must be signed in to change notification settings - Fork 790
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
Add unimplemented return information #5952
Conversation
….com/Oneflow-Inc/oneflow into add_unimplemented_return_information
Speed stats:
|
目前的错误信息感觉还有改进的空间,它应该面向用户而不是内部开发者。写错误信息的时候应该考虑用户会在这么场景下触发这个错误,然后提示给用户尽可能丰富的信息。 比如 tensor 的 parallel_desc 方法,目前的错误信息是 "MirroredTensor has no parallel_desc property",但 "MirroredTensor" 和 "parallel_desc" 都是用户陌生的概念(因为它们没有暴露到 python 层),而且错误信息也没有告诉用户该怎么做。parallel_desc 方法对应 python api 里的 placement 方法,更好一些的错误信息应该是 "Only consistent tensors have 'placement', please use '.device()' for local tensors." (placement 和 device 两侧的引号对提高用户可读性很有帮助). 再比如 AsConsistentTensor 方法,"MirroredTensor has no AsConsistentTensor property" 这个信息对用户来说也有疏离感,改成 "An error occured when converting a local tensor to consistent tensor. Check if you are calling consistent methods on local tensors" 就好一些 我先去掉了 automerge label,如果决定在下一个 pr 里再修复这些问题可以再添加回来 |
….com/Oneflow-Inc/oneflow into add_unimplemented_return_information
Speed stats:
|
优化之后的出错信息提示如下:
例如执行
修改前报错信息如下:
修改之后的错误信息如下: