-
Notifications
You must be signed in to change notification settings - Fork 823
映射文档 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
映射文档 No. 27 #5821
Conversation
感谢你贡献飞桨文档,文档预览构建中,Docs-New 跑完后即可预览,预览链接:http://preview-pr-5821.paddle-docs-preview.paddlepaddle.org.cn/documentation/docs/zh/api/index_cn.html |
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.
- name 参数映射时可以去掉
- 转写示例时为了简洁,直接使用变量即可
@@ -0,0 +1,38 @@ | |||
## [ 参数不一致 ]torch.linalg.matrix_power |
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 参数更多
~
name=None) | ||
``` | ||
|
||
两者功能一致但参数不一致,具体如下: |
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.
这句话也需要修改为对应的
| A | x | 输入的欲进行 n 次幂运算的一个或一批方阵,类型为 Tensor,仅参数名不一致。 | | ||
| n | n | 输入的幂次,类型为 int。 | | ||
|out | - | 表示输出的 Tensor , Paddle 无此参数,需要进行转写。 | | ||
| - | name | 可选,一般无需设置,默认值为 None,PyTorch 无此参数, 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.
name参数映射可以直接删去
|
||
# Paddle 写法 | ||
x = paddle.to_tensor([[1, 2, 3], [4, 5, 6], [7,8,9]]) | ||
paddle.assign(paddle.linalg.matrix_power(x, 3), y) |
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.
转写还是直接写为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。 | |
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.
name 参数映射部分都可以直接删去
name=None) | ||
``` | ||
|
||
两者功能一致但参数不一致,具体如下: |
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 | 备注 | | ||
| ------------- | ------------ | ------------------------------------------------------ | | ||
| name | - | 参数 name,PaddlePaddle 无此参数。 | |
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 | 备注 | | ||
| ------------- | ------------ | ------------------------------------------------------ | | ||
| name | - | 参数 name,PaddlePaddle 无此参数。 | | ||
| sources | sources | 用于指定自定义 OP 对应的源码文件 | |
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 | 备注 | | ||
| ------------- | ------------ | ------------------------------------------------------ | | ||
| name | - | 参数 name,PaddlePaddle 无此参数。 | |
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 | 备注 | | ||
| ------------- | ------------ | ------------------------------------------------------ | | ||
| dataset | dataset | 此参数必须是 paddle.io.Dataset 或 paddle.io.IterableDataset 的一个子类实例或实现了 __len__ 的 Python 对象,用于生成样本下标。默认值为 None。 | |
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.io.Dataset这部分,因为torch并没有这些类,直接写表示可迭代数据集。
即可
...ides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.take_along_dim.md
Outdated
Show resolved
Hide resolved
...guides/model_convert/convert_from_pytorch/api_difference/linalg/torch.linalg.matrix_power.md
Outdated
Show resolved
Hide resolved
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
| PyTorch | PaddlePaddle | 备注 | | ||
| ------------- | ------------ | ------------------------------------------------------ | | ||
| input | x | 输入多维 Tensor ,仅参数名不一致。 | | ||
| indices_or_sections | num_or_sections | int 或者仅含有 int 的 list 或者 tuple ,用于分割的参数,仅参数名不一致。 | |
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.
感谢评论,您提到的文档版本是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,已修改。
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.dsplit
和torch.split
确实不一样,前者指定块的个数,后者指定块的大小
hi, @zpc2024
|
#5691
完成分组No.27文档映射,新提交10个md文件。
paddle.utils.cpp_extension.load函数中出现interpreter 参数,源代码中没有这个参数,文档中没有添加。