-
Notifications
You must be signed in to change notification settings - Fork 766
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
171 additions
and
0 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
...l_convert/convert_from_pytorch/api_difference/ops/torch.cumulative_trapezoid.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
## [仅参数名不一致]torch.cumulative_trapezoid | ||
|
||
### [torch.cumulative_trapezoid](https://pytorch.org/docs/1.13/generated/torch.cumulative_trapezoid.html#torch.cumulative_trapezoid) | ||
|
||
```python | ||
torch.cumulative_trapezoid(y, x=None, *, dx=None, dim=-1) | ||
``` | ||
|
||
### [paddle.cumulative_trapezoid](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/cumulative_trapezoid_cn.html) | ||
|
||
```python | ||
paddle.cumulative_trapezoid(y, x=None, dx=None, axis=-1, name=None) | ||
``` | ||
|
||
两者功能一致且参数用法一致,仅参数名不同,具体如下: | ||
|
||
### 参数映射 | ||
|
||
| PyTorch | PaddlePaddle | 备注 | | ||
| ------- | ------------ | ------------------------------------------------- | | ||
| y | y | 输入多维 Tensor。 | | ||
| x | x | y 中数值对应的浮点数所组成的 Tensor。 | | ||
| dx | dx | 相邻采样点之间的常数间隔。 | | ||
| dim | axis | 计算 trapezoid rule 时 y 的维度,仅参数名不一致。 | |
39 changes: 39 additions & 0 deletions
39
...guides/model_convert/convert_from_pytorch/api_difference/ops/torch.histogram.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
## [torch 参数更多]torch.histogram | ||
|
||
### [torch.histogram](https://pytorch.org/docs/1.13/generated/torch.histogram.html#torch.histogram) | ||
|
||
```python | ||
torch.histogram(input, bins, *, range=None, weight=None, density=False, out=None) | ||
``` | ||
|
||
### [paddle.histogram](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/histogram_cn.html) | ||
|
||
```python | ||
paddle.histogram(input, bins=100, min=0, max=0, name=None) | ||
``` | ||
|
||
其中 Pytorch 相比 Paddle 支持更多其他参数,具体如下: | ||
|
||
### 参数映射 | ||
|
||
| PyTorch | PaddlePaddle | 备注 | | ||
| ------- | ------------ | -------------------------------------------------------------------------------------------------- | | ||
| input | input | 输入 Tensor。 | | ||
| bins | bins | 直方图 bins(直条)的个数。 | | ||
| range | min, max | PyTorch 为 bins 的范围,类型为 float,Paddle 为 range 的下边界,上边界,类型为 int,需要进行转写。 | | ||
| weight | - | 权重,Paddle 无此参数,暂无转写方式。 | | ||
| density | - | 结果中每个 bin 是否包含权重数,Paddle 无此参数,暂无转写方式。 | | ||
|
||
### 转写示例 | ||
|
||
#### range 参数:bins 的范围 | ||
|
||
```python | ||
# PyTorch 写法: | ||
x = torch.tensor([1., 2, 1]) | ||
y = torch.histogram(x, bins=5, range=(0., 3.)) | ||
|
||
# Paddle 写法: | ||
x = paddle.to_tensor([1, 2, 1]) | ||
y = paddle.histogram(x, bins=5, min=0, max=3) | ||
``` |
36 changes: 36 additions & 0 deletions
36
...es/model_convert/convert_from_pytorch/api_difference/others/torch.special.i0.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
## [torch 参数更多]torch.special.i0 | ||
|
||
### [torch.special.i0](https://pytorch.org/docs/1.13/special.html#torch.special.i0) | ||
|
||
```python | ||
torch.special.i0(input, *, out=None) | ||
``` | ||
|
||
### [paddle.i0](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/i0_cn.html) | ||
|
||
```python | ||
paddle.i0(x, name=None) | ||
``` | ||
|
||
其中 Pytorch 相比 Paddle 支持更多其他参数,具体如下: | ||
|
||
### 参数映射 | ||
|
||
| PyTorch | PaddlePaddle | 备注 | | ||
| ------- | ------------ | -------------------------------------------------- | | ||
| input | x | 表示输入的 Tensor,仅参数名不一致。 | | ||
| out | - | 表示输出的 Tensor,Paddle 无此参数,需要进行转写。 | | ||
|
||
### 转写示例 | ||
|
||
#### out:指定输出 | ||
|
||
```python | ||
# Pytorch 写法 | ||
x = torch.tensor([1, 2, 3, 4, 5], dtype=torch.float32) | ||
torch.special.i0(x, out=y) | ||
|
||
# Paddle 写法 | ||
x = paddle.to_tensor([1, 2, 3, 4, 5], dtype="float32") | ||
paddle.assign(paddle.i0(x), y) | ||
``` |
36 changes: 36 additions & 0 deletions
36
...es/model_convert/convert_from_pytorch/api_difference/others/torch.special.i1.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
## [torch 参数更多]torch.special.i1 | ||
|
||
### [torch.special.i1](https://pytorch.org/docs/1.13/special.html#torch.special.i1) | ||
|
||
```python | ||
torch.special.i1(input, *, out=None) | ||
``` | ||
|
||
### [paddle.i1](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/i1_cn.html) | ||
|
||
```python | ||
paddle.i1(x, name=None) | ||
``` | ||
|
||
其中 Pytorch 相比 Paddle 支持更多其他参数,具体如下: | ||
|
||
### 参数映射 | ||
|
||
| PyTorch | PaddlePaddle | 备注 | | ||
| ------- | ------------ | -------------------------------------------------- | | ||
| input | x | 表示输入的 Tensor,仅参数名不一致。 | | ||
| out | - | 表示输出的 Tensor,Paddle 无此参数,需要进行转写。 | | ||
|
||
### 转写示例 | ||
|
||
#### out:指定输出 | ||
|
||
```python | ||
# Pytorch 写法 | ||
x = torch.tensor([1, 2, 3, 4, 5], dtype=torch.float32) | ||
torch.special.i1(x, out=y) | ||
|
||
# Paddle 写法 | ||
x = paddle.to_tensor([1, 2, 3, 4, 5], dtype="float32") | ||
paddle.assign(paddle.i1(x), y) | ||
``` |
36 changes: 36 additions & 0 deletions
36
...s/model_convert/convert_from_pytorch/api_difference/others/torch.special.i1e.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
## [torch 参数更多]torch.special.i1e | ||
|
||
### [torch.special.i1e](https://pytorch.org/docs/1.13/special.html#torch.special.i1e) | ||
|
||
```python | ||
torch.special.i1e(input, *, out=None) | ||
``` | ||
|
||
### [paddle.i1e](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/i1e_cn.html) | ||
|
||
```python | ||
paddle.i1e(x, name=None) | ||
``` | ||
|
||
其中 Pytorch 相比 Paddle 支持更多其他参数,具体如下: | ||
|
||
### 参数映射 | ||
|
||
| PyTorch | PaddlePaddle | 备注 | | ||
| ------- | ------------ | -------------------------------------------------- | | ||
| input | x | 表示输入的 Tensor,仅参数名不一致。 | | ||
| out | - | 表示输出的 Tensor,Paddle 无此参数,需要进行转写。 | | ||
|
||
### 转写示例 | ||
|
||
#### out:指定输出 | ||
|
||
```python | ||
# Pytorch 写法 | ||
x = torch.tensor([1, 2, 3, 4, 5], dtype=torch.float32) | ||
torch.special.i1e(x, out=y) | ||
|
||
# Paddle 写法 | ||
x = paddle.to_tensor([1, 2, 3, 4, 5], dtype="float32") | ||
paddle.assign(paddle.i1e(x), y) | ||
``` |