Skip to content

映射文档 No. 27 #5821

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

Merged
merged 5 commits into from
Apr 28, 2023
Merged

映射文档 No. 27 #5821

merged 5 commits into from
Apr 28, 2023

Conversation

zpc2024
Copy link
Contributor

@zpc2024 zpc2024 commented Apr 23, 2023

#5691
完成分组No.27文档映射,新提交10个md文件。
paddle.utils.cpp_extension.load函数中出现interpreter 参数,源代码中没有这个参数,文档中没有添加。

@paddle-bot
Copy link

paddle-bot bot commented Apr 23, 2023

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

@CLAassistant
Copy link

CLAassistant commented Apr 23, 2023

CLA assistant check
All committers have signed the CLA.

Copy link
Collaborator

@Fancy-hjyp Fancy-hjyp left a comment

Choose a reason for hiding this comment

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

  • name 参数映射时可以去掉
  • 转写示例时为了简洁,直接使用变量即可

@@ -0,0 +1,38 @@
## [ 参数不一致 ]torch.linalg.matrix_power
Copy link
Collaborator

Choose a reason for hiding this comment

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

分类应该为 torch 参数更多~

name=None)
```

两者功能一致但参数不一致,具体如下:
Copy link
Collaborator

Choose a reason for hiding this comment

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

这句话也需要修改为对应的

| A | x | 输入的欲进行 n 次幂运算的一个或一批方阵,类型为 Tensor,仅参数名不一致。 |
| n | n | 输入的幂次,类型为 int。 |
|out | - | 表示输出的 Tensor , Paddle 无此参数,需要进行转写。 |
| - | 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.

name参数映射可以直接删去


# Paddle 写法
x = paddle.to_tensor([[1, 2, 3], [4, 5, 6], [7,8,9]])
paddle.assign(paddle.linalg.matrix_power(x, 3), y)
Copy link
Collaborator

Choose a reason for hiding this comment

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

转写还是直接写为y = paddle.linalg.matrix_power(x, 3)即可,同时为了示例的简便,可以不用定义x = paddle.to_tensor([[1, 2, 3], [4, 5, 6], [7,8,9]]), 直接使用即可,下面类似

| input | x | 输入多维 Tensor ,仅参数名不一致。 |
| indices_or_sections | num_or_sections | int 或者仅含有 int 的 list 或者 tuple ,用于分割的参数,仅参数名不一致。 |
| - | axis | 可选,默认为 0 ,表示需要分割的维度,PyTorch 无此参数,Paddle 保持默认即可。 |
| - | name | 可选,一般无需设置,默认值为 None。 |
Copy link
Collaborator

Choose a reason for hiding this comment

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

name 参数映射部分都可以直接删去

name=None)
```

两者功能一致但参数不一致,具体如下:
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 | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
| name | - | 参数 name,PaddlePaddle 无此参数。 |
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 | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
| name | - | 参数 name,PaddlePaddle 无此参数。 |
| sources | sources | 用于指定自定义 OP 对应的源码文件 |
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 | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
| name | - | 参数 name,PaddlePaddle 无此参数。 |
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 | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
| dataset | dataset | 此参数必须是 paddle.io.Dataset 或 paddle.io.IterableDataset 的一个子类实例或实现了 __len__ 的 Python 对象,用于生成样本下标。默认值为 None。 |
Copy link
Collaborator

Choose a reason for hiding this comment

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

这里的备注不需要写必须是paddle.io.Dataset这部分,因为torch并没有这些类,直接写表示可迭代数据集。 即可

Copy link
Collaborator

@Fancy-hjyp Fancy-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

| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
| input | x | 输入多维 Tensor ,仅参数名不一致。 |
| indices_or_sections | num_or_sections | int 或者仅含有 int 的 list 或者 tuple ,用于分割的参数,仅参数名不一致。 |
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

@zpc2024 zpc2024 Apr 25, 2023

Choose a reason for hiding this comment

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

感谢评论,您提到的文档版本是torch2.0版本的,我查阅1.13的文档
https://pytorch.org/docs/1.13/generated/torch.dsplit.html#torch.dsplit
https://pytorch.org/docs/1.13/generated/torch.tensor_split.html#torch-tensor-split
确认了indices_or_sections 参数和 num_or_sections 参数,仅参数名不一致。
paddle.split axis参数应该采用2,而不是默认0,已修改。

Copy link
Collaborator

Choose a reason for hiding this comment

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

了解了。torch.dsplittorch.split确实不一样,前者指定块的个数,后者指定块的大小

@zhwesky2010 zhwesky2010 merged commit 3f0812d into PaddlePaddle:develop Apr 28, 2023
@luotao1
Copy link
Collaborator

luotao1 commented Apr 28, 2023

hi, @zpc2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants