-
Notifications
You must be signed in to change notification settings - Fork 765
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. 49 #5849
映射文档 No. 49 #5849
Conversation
感谢你贡献飞桨文档,文档预览构建中,Docs-New 跑完后即可预览,预览链接:http://preview-pr-5849.paddle-docs-preview.paddlepaddle.org.cn/documentation/docs/zh/api/index_cn.html |
|
@Tomoko-hjf 辛苦review一下,感谢:) |
torch.qr(x, out = (q,r) ) | ||
|
||
# Paddle 写法 | ||
paddle.assign(paddle.linalg.qr(x), (q,r) ) |
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.
这样写应该是不能运行的,可以写为q, r = paddle.linalg.qr(x)
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 | PaddlePaddle | 备注 | | ||
| ------------- | ------------ | ------------------------------------------------------ | | ||
| input | x | 输入 Tensor ,仅参数名不一致。 | | ||
| some | full_matrics | 表示需计算的奇异值数目。 与 Pytorch 默认值不同, Pytorch 默认为 True , Paddle 默认为 False。 | |
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.svd(x, out=(u, s, v) ) | ||
|
||
# Paddle 写法 | ||
paddle.assign(paddle.linalg.svd(x), (u, s, v) ) |
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.
这里输出元组,应该只能 u, s, v = paddle.linalg.svd(x)
这样赋值
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.symeig(x, out=(e, v) ) | ||
|
||
# Paddle 写法 | ||
paddle.assign(paddle.linalg.eigh(x), (e, v) ) |
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.assign
完成
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.
已修改。
剩余的6个API文件已经存在了吗,如果是paddle暂无对应功能,可以在comment中说明~ |
剩余6个api映射文件已经存在了,再次检查修改了其中两个文件中错误的link~ |
所有问题均已修改更正,同时更正torch.mm.md和torch.mv.md中两个失效的link |
@Tomoko-hjf 您好,在任务列表的issue中,No.57 的认领人是不是有误,我目前只认领了No.49这个任务,麻烦check下:) |
torch.symeig(input, eigenvectors=False, upper=True, *, out=None) | ||
``` | ||
|
||
### [paddle.linalg.svd](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/linalg/eigh_cn.html#eigh) |
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.linalg.eigh
吧
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.
LGTM
@zhwesky2010 PTAL :) |
### some:控制 QR 分解的行为 | ||
```python | ||
# Pytorch 写法 | ||
q, r = torch.qr(x, some=False) |
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.
some=True时怎么转写,也需要加上
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 | PaddlePaddle | 备注 | | ||
| ------------- | ------------ | ------------------------------------------------------ | | ||
| input | x | 输入 Tensor ,仅参数名不一致。 | | ||
| some | full_matrics | 表示需计算的奇异值数目。 与 Pytorch 默认值不同,需要转写。 | |
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.svd中的some参数默认值为True
,paddle.linalg.svd中的full_matrics参数默认值为False
,他们的默认值所导致的函数功能是一样的,都是不计算完整的 U 和 V 矩阵,所以这样的情况我加了转写示例
| PyTorch | PaddlePaddle | 备注 | | ||
| ------------- | ------------ | ------------------------------------------------------ | | ||
| input | x | 输入的对称 Tensor,仅参数名不一致。 | | ||
| eigenvectors | - | 表示是否计算特征向量。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.
这个应该也没办法组合出来对吧
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中的eigenvectors参数表示是同时计算特征向量和特征值还是只计算特征值,paddle.linalg.eigh函数中没有这个功能对应,无法组合转写。
torch.symeig这个函数其实可以由torch.linalg.eigh所替代,且在官方文档中建议使用torch.linalg.eigh(),并表示在后续版本中移除torch.symeig
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.
LGTM
hi, @whyn0tdance
|
完成PyTorch 1.13 与 Paddle 2.4 API 映射文档开源任务中No.49的文档映射工作,其中新增4个文档,如有问题请随时联系 :)