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.
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
【Hackathon 5th No.42】 为Paddle代码转换工具新增API转换规则 (第1组 编号1-20)-part #6212
【Hackathon 5th No.42】 为Paddle代码转换工具新增API转换规则 (第1组 编号1-20)-part #6212
Changes from 6 commits
52028bc
e46bf1f
614b9ad
1b437f1
ceb6d6e
f61679a
a25edd2
aab37c2
938fad1
a2c64ee
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.
仅参数名不一致
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.
torch.Tensor.view
有多种用法,还有dtype的用法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.
你这个写了 仅参数名不一致 吗?
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.
这里是参考了其他文档, 比如 torch.histc.md。
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.
interpolation 这个不能转写,写示例不用加上
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.
这个有办法组合替代实现吧,比如说判断x.place
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和Torch的pin_memory有一点不太一致。
Paddle 代码:
Torch 代码:
即 Paddle 仅支持 CUDA Pin, 而 Torch 仅支持 dense CPU tensors to pin memory。
请问是否忽略这一点呢?
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的代码转换为paddle如何呈现(前提是torch代码可正常运行),不关注其他的地方。上文中的
x.is_pinned()
如果转为 paddle的写法,'pinned' in x.place
这种写法有问题吗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.
好的,可以通过
'pinned' in str(x.place)
去判断。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.
这个没办法组合替代实现吗
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.sum_to_size 的实现是借助 sum_to 实现的其源码如下:
由于 Paddle 中没有 sum_to API 因此我不知道该如何去组合替代实现 sum_to_size.
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.
这个就先按功能缺失来吧