-
Notifications
You must be signed in to change notification settings - Fork 764
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add task 2 * update conversion * fix conversation
- Loading branch information
1 parent
b1b1677
commit 3f9af5f
Showing
11 changed files
with
172 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
15 changes: 15 additions & 0 deletions
15
...ides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.T.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,15 @@ | ||
## [ 无参数 ] torch.Tensor.T | ||
|
||
### [torch.Tensor.T](https://pytorch.org/docs/stable/tensors.html#torch.Tensor.T) | ||
|
||
```python | ||
torch.Tensor.T | ||
``` | ||
|
||
### [paddle.Tensor.T](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/Tensor_cn.html#tensor) | ||
|
||
```python | ||
paddle.Tensor.T | ||
``` | ||
|
||
两者功能一致,均无参数。 |
15 changes: 15 additions & 0 deletions
15
...model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.device.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,15 @@ | ||
## [ 无参数 ] torch.Tensor.device | ||
|
||
### [torch.Tensor.device](https://pytorch.org/docs/stable/generated/torch.Tensor.device.html) | ||
|
||
```python | ||
torch.Tensor.device | ||
``` | ||
|
||
### [paddle.Tensor.place](https://www.paddlepaddle.org.cn/documentation/docs/api/paddle/Tensor_cn.html#place) | ||
|
||
```python | ||
paddle.Tensor.place | ||
``` | ||
|
||
两者功能一致,均无参数,都用来查看一个 Tensor 的设备位置。 |
15 changes: 15 additions & 0 deletions
15
...s/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.grad.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,15 @@ | ||
## [ 无参数 ] torch.Tensor.grad | ||
|
||
### [torch.Tensor.grad](https://pytorch.org/docs/stable/generated/torch.Tensor.grad.html) | ||
|
||
```python | ||
torch.Tensor.grad | ||
``` | ||
|
||
### [paddle.Tensor.grad](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/Tensor_cn.html#grad) | ||
|
||
```python | ||
paddle.Tensor.grad | ||
``` | ||
|
||
两者功能一致,均无参数,都用来查看一个 Tensor 的梯度。 |
15 changes: 15 additions & 0 deletions
15
...s/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.imag.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,15 @@ | ||
## [ 无参数 ] torch.Tensor.imag | ||
|
||
### [torch.Tensor.imag](https://pytorch.org/docs/stable/generated/torch.Tensor.imag.html) | ||
|
||
```python | ||
torch.Tensor.imag | ||
``` | ||
|
||
### [paddle.Tensor.imag](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/Tensor_cn.html#imag-name-none) | ||
|
||
```python | ||
paddle.Tensor.imag | ||
``` | ||
|
||
两者功能一致,均无参数,用于返回原复数 Tensor 的虚部数值。 |
15 changes: 15 additions & 0 deletions
15
...odel_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.is_leaf.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,15 @@ | ||
## [ 无参数 ] torch.Tensor.is_leaf | ||
|
||
### [torch.Tensor.is_leaf](https://pytorch.org/docs/stable/generated/torch.Tensor.is_leaf.html) | ||
|
||
```python | ||
torch.Tensor.is_leaf | ||
``` | ||
|
||
### [paddle.Tensor.is_leaf](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/Tensor_cn.html#is-leaf) | ||
|
||
```python | ||
paddle.Tensor.is_leaf | ||
``` | ||
|
||
两者功能一致,均无参数,判断 Tensor 是否为叶子 Tensor。 |
26 changes: 26 additions & 0 deletions
26
...el_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.is_sparse.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,26 @@ | ||
## [ 无参数 ] torch.Tensor.is_sparse | ||
|
||
### [torch.Tensor.is_sparse](https://pytorch.org/docs/stable/generated/torch.Tensor.is_sparse.html) | ||
|
||
```python | ||
torch.Tensor.is_sparse | ||
``` | ||
|
||
### [paddle.Tensor.is_sparse](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/Tensor_cn.html) | ||
|
||
```python | ||
paddle.Tensor.is_sparse() | ||
``` | ||
|
||
两者功能一致,但使用方式不一致,前者可以直接访问属性,后者需要调用方法,具体如下: | ||
|
||
### 转写示例 | ||
``` | ||
# torch 版本可以直接访问属性 | ||
# x = torch.rand(3) | ||
# print(x.is_sparse) | ||
# Paddle 版本需要调用 | ||
x = paddle.rand([3]) | ||
print(x.is_sparse()) | ||
``` |
15 changes: 15 additions & 0 deletions
15
...s/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.ndim.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,15 @@ | ||
## [ 无参数 ] torch.Tensor.ndim | ||
|
||
### [torch.Tensor.ndim](https://pytorch.org/docs/stable/generated/torch.Tensor.ndim.html) | ||
|
||
```python | ||
torch.Tensor.ndim | ||
``` | ||
|
||
### [paddle.Tensor.ndim](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/Tensor_cn.html#ndim) | ||
|
||
```python | ||
paddle.Tensor.ndim | ||
``` | ||
|
||
两者功能一致,均无参数,查看一个 Tensor 的维度。 |
15 changes: 15 additions & 0 deletions
15
...s/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.real.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,15 @@ | ||
## [ 无参数 ] torch.Tensor.real | ||
|
||
### [torch.Tensor.real](https://pytorch.org/docs/stable/generated/torch.Tensor.real.html) | ||
|
||
```python | ||
torch.Tensor.real | ||
``` | ||
|
||
### [paddle.Tensor.real](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/Tensor_cn.html#real-name-none) | ||
|
||
```python | ||
paddle.Tensor.real | ||
``` | ||
|
||
两者功能一致,均无参数,用于返回 Tensor 的实部数值。 |
15 changes: 15 additions & 0 deletions
15
.../model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.shape.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,15 @@ | ||
## [ 无参数 ] torch.Tensor.shape | ||
|
||
### [torch.Tensor.shape](https://pytorch.org/docs/stable/generated/torch.Tensor.shape.html) | ||
|
||
```python | ||
torch.Tensor.shape | ||
``` | ||
|
||
### [paddle.Tensor.shape](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/Tensor_cn.html#shape) | ||
|
||
```python | ||
paddle.Tensor.shape | ||
``` | ||
|
||
两者功能一致,均无参数,都用来查看一个 Tensor 的 shape,shape 是 Tensor 的一个重要的概念,其描述了 tensor 在每个维度上的元素数量。 |
26 changes: 26 additions & 0 deletions
26
...nvert_from_pytorch/api_difference/functional/torch.nn.functional.affine_grid.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,26 @@ | ||
## [ 仅参数名不一致 ] torch.nn.functional.affine_grid | ||
|
||
### [torch.nn.functional.affine_grid](https://pytorch.org/docs/stable/generated/torch.nn.functional.affine_grid.html?highlight=affine_grid#torch.nn.functional.affine_grid) | ||
|
||
```python | ||
torch.nn.functional.affine_grid(theta, | ||
size, | ||
align_corners=None) | ||
``` | ||
|
||
### [paddle.nn.functional.affine_grid](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/nn/functional/affine_grid_cn.html) | ||
|
||
```python | ||
paddle.nn.functional.affine_grid(theta, | ||
out_shape, | ||
align_corners=True, | ||
name=None) | ||
``` | ||
|
||
两者功能一致,仅参数名不一致,具体如下: | ||
### 参数映射 | ||
| PyTorch | PaddlePaddle | 备注 | | ||
| ------------- | ------------ | ------------------------------------------------------ | | ||
| theta | theta | 指定仿射变换矩阵 | | ||
| size | out_shape | 表示指定目标输出图像大小,仅参数名不一致。 | | ||
| align_corners | align_corners | 指定是否是像素中心对齐 | |