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.
新增映射文档 #7081
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
新增映射文档 #7081
Changes from all commits
ed34bc2
1d77aac
a617301
b7f12ca
2be1f0a
467f091
4f73037
ecb30a7
2995869
d9240e6
e571b61
9aae6cd
e1590b8
fa80805
f08ac92
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
这个是对device的转写,再加一个对返回参数的转写。对返回参数的转写,不需要传入device参数。
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.
如果device无输入的话,应该是取第一个值吗?
paddle.get_cuda_rng_state()[0]
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.
这个在Matcher部分又重新修改了一下
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.
有几处错误:
torch的这两个API是给全局所有layer注册的hook,而paddle是单个layer的,这个差异必须要强调
torch.nn.modules.module.register_module_forward_hook
torch.nn.modules.module.register_module_forward_pre_hook
我查阅文档,没有发现register_module_forward_hook的prepend参数,这个参数是怎么来的?
https://pytorch.org/docs/main/generated/torch.nn.modules.module.register_module_forward_hook.html#torch-nn-modules-module-register-module-forward-hook
always_call我觉得不影响计算的结果,可以算作直接删除
这么看这两个API是无法自动转换的,可以写映射文档但Matcher是无法实现的(因为paddle没有类似的全局注册的API,只有单个注册的,没法将全局自动转为单个的逐个注册)。而PaConvert写的也有问题,由于单测是错的,直接用的
Module.register_forward_hook
,压根就没跑torch.nn.modules.module.register_module_forward_hook
,导致两个错误Matcher没有测试到。后续还是要保证代码的正确性。这些API只是初筛认为有对应功能,如果没有对应功能,就按你思考与判断的结论来处理,而不是一定要弄个错误的上去。
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.
prepend会控制pre、post吗?always_call会导致不调用吗?with_kwargs影响参数传递方式吗?
得看看这三个参数的影响是什么,是否会导致paddle的运行结果不同,如果对运行结果无影响就不用管 直接删除了
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.
这三个参数应该都有可能会导致运行结果不同,prepend控制当前注册的 hook 相对于已有 hook 的调用顺序,always_call如果设置为True的话,则在抛出异常会调用,with_kwargs会影响传递给hook的参数
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.
这个分类不对,另外放到功能缺失里,你得细分一下类。
功能缺失也有好几类。