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.72 #5869

Merged
merged 5 commits into from
May 16, 2023
Merged

映射文档 No.72 #5869

merged 5 commits into from
May 16, 2023

Conversation

carloscjl
Copy link
Contributor

完成对映射文件No.72的工作。

@paddle-bot
Copy link

paddle-bot bot commented May 8, 2023

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

@luotao1 luotao1 changed the title my-72-PR 映射文档-72-PR May 8, 2023
@carloscjl carloscjl changed the title 映射文档-72-PR 映射文档 No.72 May 8, 2023
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.

对于多个输出的情况,比如torch.linalg.lu,三个输出值是不能通过paddle.assign赋值的,可以改为 P, L, U = paddle.linalg.triangular_solve(A)
相应pytorch 代码改为 torch.linalg.solve_triangular(A, out=(P, L, U))

@@ -0,0 +1,33 @@
## [ torch 参数更多 ]torch.Tensor.arctan2
Copy link
Collaborator

Choose a reason for hiding this comment

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

修改完api签名之后,除去第一个参数后,只有参数名不一致,所以分类名写为 仅参数名不一致

### [torch.Tensor.arctan2](https://pytorch.org/docs/1.13/generated/torch.arctan2.html#torch.arctan2)

```python
torch.Tensor.arctan2(self, other, *, out=None)
Copy link
Collaborator

Choose a reason for hiding this comment

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

这里的签名写成 torch.Tensor.arctan2(other) 即可,可以参考已经合并的PR #5778 和格式文档 https://github.com/PaddlePaddle/docs/blob/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/pytorch_api_mapping_format_cn.md
image
Uploading image.png…

paddle.atan2(x, y, name=None)
```

Pytorch 相比 Paddle 支持更多其他参数,具体如下:
Copy link
Collaborator

Choose a reason for hiding this comment

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

这句话需要修改为 两者功能一致且参数用法一致,仅参数名不一致,具体如下:

| other | y | 表示输入的 Tensor ,仅参数名不一致。 |
| out | - | 表示输出的 Tensor , Paddle 无此参数,需要进行转写。 |

### 转写示例
Copy link
Collaborator

Choose a reason for hiding this comment

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

修改之后不需要转写示例了~

| PyTorch | PaddlePaddle | 备注 |
| ----------------------------------- | ------------ | ----------------------------------------------------------------------- |
| self | x | 表示输入的 Tensor ,仅参数名不一致。 |
| other | y | 表示输入的 Tensor ,仅参数名不一致。 |
Copy link
Collaborator

Choose a reason for hiding this comment

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

参数映射部分只写 other 即可

### [torch.Tensor.cdouble](https://pytorch.org/docs/1.13/generated/torch.Tensor.cdouble.html?highlight=torch+tensor+cdouble#torch.Tensor.cdouble)

```python
Tensor.cdouble(memory_format=torch.preserve_format)
Copy link
Collaborator

Choose a reason for hiding this comment

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

签名前面加一个torch吧, 即 torch.Tensor.xxx

Tensor.cdouble(memory_format=torch.preserve_format)
```

### [paddle.Tensor.astype('complex128')](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/Tensor_cn.html#astype-dtype)
Copy link
Collaborator

Choose a reason for hiding this comment

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

这里直接写 paddle.Tensor.astype即可

Tensor.cfloat(memory_format=torch.preserve_format)
```

### [paddle.Tensor.astype('complex64')](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/Tensor_cn.html#astype-dtype)
Copy link
Collaborator

Choose a reason for hiding this comment

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

可以直接写 paddle.Tensor.astype,这里先不需要写complex64

Copy link
Contributor Author

Choose a reason for hiding this comment

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

谢谢您的指点与回复,我已经全部修改,劳烦您继续审核。

| ----------------------------------- | ------------ | ----------------------------------------------------------------------- |
| A | x | 表示需要进行 LU 分解的输入 Tensor ,仅参数名不一致。 |
| pivot | pivot | 表示 LU 分解时是否进行旋转。 |
| - | get_infos | 表示是否返回分解状态信息。 |
Copy link
Collaborator

Choose a reason for hiding this comment

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

这里的备注加一句 Paddle 保持默认即可 ~

Copy link
Contributor Author

Choose a reason for hiding this comment

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

您好,已经修改了,麻烦您继续审核

| A | x | 表示线性方程组左边的系数 Tensor ,仅参数名不一致。 |
| B | y | 表示线性方程组右边的 Tensor ,仅参数名不一致。 |
| upper | upper | 表示对系数 Tensor 取上三角还是下三角。 |
| left | transpose | 表示是否对系数 Tensor 进行转置。 |
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.

辛苦您了!我已经添加了,麻烦您审核还有啥其他问题?

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

@carloscjl
Copy link
Contributor Author

@zhwesky2010 您好,打扰您了,能麻烦您有时间审核一下吗?

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 28028b3 into PaddlePaddle:develop May 16, 2023
@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.

4 participants