Skip to content
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

Merged
merged 6 commits into from
May 12, 2023
Merged

映射文档 No. 49 #5849

merged 6 commits into from
May 12, 2023

Conversation

whyn0tdance
Copy link
Contributor

完成PyTorch 1.13 与 Paddle 2.4 API 映射文档开源任务中No.49的文档映射工作,其中新增4个文档,如有问题请随时联系 :)

@CLAassistant
Copy link

CLAassistant commented May 3, 2023

CLA assistant check
All committers have signed the CLA.

@paddle-bot
Copy link

paddle-bot bot commented May 3, 2023

感谢你贡献飞桨文档,文档预览构建中,Docs-New 跑完后即可预览,预览链接:http://preview-pr-5849.paddle-docs-preview.paddlepaddle.org.cn/documentation/docs/zh/api/index_cn.html
预览工具的更多说明,请参考:飞桨文档预览工具

@whyn0tdance
Copy link
Contributor Author

完成PyTorch 1.13 与 Paddle 2.4 API 映射文档开源任务中No.49的文档映射工作,其中新增4个文档,如有问题请随时联系 :)

(#5691 (comment))

@whyn0tdance
Copy link
Contributor Author

@Tomoko-hjf 辛苦review一下,感谢:)

torch.qr(x, out = (q,r) )

# Paddle 写法
paddle.assign(paddle.linalg.qr(x), (q,r) )
Copy link
Collaborator

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)

Copy link
Contributor Author

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。 |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

默认值不一样的情况补充一个转写示例吧~

Copy link
Contributor Author

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) )
Copy link
Collaborator

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)这样赋值

Copy link
Contributor Author

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) )
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

元组的赋值应该不能通过paddle.assign 完成

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已修改。

@huajiao-hjyp
Copy link
Collaborator

剩余的6个API文件已经存在了吗,如果是paddle暂无对应功能,可以在comment中说明~

@whyn0tdance
Copy link
Contributor Author

whyn0tdance commented May 4, 2023

剩余的6个API文件已经存在了吗,如果是paddle暂无对应功能,可以在comment中说明~

剩余6个api映射文件已经存在了,再次检查修改了其中两个文件中错误的link~

@whyn0tdance
Copy link
Contributor Author

所有问题均已修改更正,同时更正torch.mm.md和torch.mv.md中两个失效的link

@whyn0tdance
Copy link
Contributor Author

@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)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里的名称应该为 paddle.linalg.eigh

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已修改~

@huajiao-hjyp
Copy link
Collaborator

@Tomoko-hjf 您好,在任务列表的issue中,No.57 的认领人是不是有误,我目前只认领了No.49这个任务,麻烦check下:)

好的,已修改~

Copy link
Collaborator

@huajiao-hjyp huajiao-hjyp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@whyn0tdance
Copy link
Contributor Author

@zhwesky2010 PTAL :)

### some:控制 QR 分解的行为
```python
# Pytorch 写法
q, r = torch.qr(x, some=False)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some=True时怎么转写,也需要加上

Copy link
Contributor Author

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 默认值不同,需要转写。 |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

默认值看起来是一样的,但是功能是相反的

Copy link
Contributor Author

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 暂无转写方式。 |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个应该也没办法组合出来对吧

Copy link
Contributor Author

@whyn0tdance whyn0tdance May 10, 2023

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

Copy link
Collaborator

@zhwesky2010 zhwesky2010 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zhwesky2010 zhwesky2010 merged commit e782cac into PaddlePaddle:develop May 12, 2023
@luotao1
Copy link
Collaborator

luotao1 commented May 16, 2023

hi, @whyn0tdance

  • 非常感谢你对飞桨框架的贡献,我们正在运营一个PFCC组织,会通过定期分享技术知识与发布开发者主导任务的形式持续为飞桨框架做贡献,详情可见 https://github.com/luotao1 主页说明。
  • 如果你对PFCC有兴趣,请发送邮件至 [email protected],我们会邀请你加入~

@luotao1 luotao1 added the HappyOpenSource 快乐开源活动issue与PR label Aug 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants