-
Notifications
You must be signed in to change notification settings - Fork 53
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
转换规则 No.388/389/390 #155
转换规则 No.388/389/390 #155
Conversation
Thanks for your contribution! |
result = ">>>" | ||
""" | ||
) | ||
obj.run( |
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.
CPU为什么不支持呢,paddle也有.cpu用法
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.
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.
可以直接跑代码,最终均以代码为准。
这个文档在paddle.Tensor里:https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/Tensor_cn.html#cpu
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.
tests/test_nn_Module_cuda.py
Outdated
module1 = torch.nn.Module() | ||
module1.register_buffer('buffer', x) | ||
module1.cuda() | ||
result = ">>>" |
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.
cuda为什么不支持呢,paddle也有这个功能,result=">>>"这个就不要写了,用户代码不可能有这个
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.
另外只需要处理issue里408个任务的API,其他的API在发布任务都已经做了筛选分析或者实现。 |
好的 |
上面看错了看成是torch.Tensor.cpu,这个确实API缺失,你先改成 def _test 这种无法运行的形式吧 |
如果api缺失,也需要文档,在pytorch_api_mapping里写下功能缺失。单测需要开发 不运行的注释版本。 |
已找到匹配api https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/nn/Layer_cn.html#to-device-none-dtype-none-blocking-none 已修改 xpu 为 def _test ,转换cpu, cuda |
好的那再创建PR |
tests/apibase.py
Outdated
@@ -174,6 +174,7 @@ def convert(self, pytorch_code): | |||
f.write(pytorch_code) | |||
|
|||
converter = Converter(log_dir="disable") | |||
converter.set_test_api(self.pytorch_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.
这个可能没法像这样判断,因为单测里只有一种类型pytorch_api,但是在实际代码里是混合的,只为跑通单测意义不大,单测的价值就是模仿用户代码。
这3个API先按功能缺失来吧,后面会新增cpu、gpu、xpu三个api,这样也就不存在Module和Tensor的差异了
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.
已修改
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.
PR Docs
#112
已取消 修改 paconvert/transformer/basic_transformer.py,增加test_api变量,传入需要测试的api名称,按api名称判断匹配顺序 torch.nn.Module, torch.Tensor,比如cpu类型,原来是拼接为 torch.Tensor.cpu 匹配,这样使用的Matcher不对,需要匹配torch.nn.Module.cpu
xpu类型CI不能测试,修改为_def test
PR APIs
[used AI Studio]