Skip to content

Commit 9d1521a

Browse files
authored
映射文档 No 7~10 (#5727)
* add 7~10 * 按照所提建议修改 * 按建议修改 * torch.Tensor.equal.md 已修改 * 对于非类成员调用,更改分类;cross 补全函数名;fliplr/pud增加说明; * 已按建议修改“ * 改写 torch.Tensor.equal 的转写示例 * 按要求修改
1 parent a7af0a1 commit 9d1521a

40 files changed

+804
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
## [ 无参数 ]torch.Tensor.arccosh
2+
3+
### [torch.Tensor.arccosh](https://pytorch.org/docs/stable/generated/torch.Tensor.arccosh.html?highlight=arccosh#torch.Tensor.arccosh)
4+
5+
```python
6+
torch.Tensor.arccosh()
7+
```
8+
9+
### [paddle.Tensor.acosh](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/acosh_cn.html#acosh)
10+
11+
```python
12+
paddle.Tensor.acosh(name=None)
13+
```
14+
15+
两者功能完全一致,无参数。
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
## [ torch 参数更多 ]torch.Tensor.cpu
2+
3+
### [torch.Tensor.cpu](https://pytorch.org/docs/stable/generated/torch.Tensor.cpu.html?highlight=torch+tensor+cpu#torch.Tensor.cpu)
4+
5+
```python
6+
torch.Tensor.cpu(memory_format=torch.preserve_format)
7+
```
8+
9+
### [paddle.Tensor.cpu](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/Tensor_cn.html#cpu)
10+
11+
```python
12+
paddle.Tensor.cpu()
13+
```
14+
15+
两者功能一致,其中 Pytorch 相比 Paddle 支持更多其他参数,具体如下:
16+
17+
### 参数映射
18+
19+
| PyTorch | PaddlePaddle | 备注 |
20+
| ----------------------------------- | ------------ | ----------------------------------------------------------------------- |
21+
| memory_format=torch.preserve_format | - | 表示内存格式,Paddle 无此参数,一般对网络训练结果影响不大,可直接删除。 |
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
## [ 仅参数名不一致 ]torch.Tensor.cross
2+
3+
### [torch.Tensor.cross](https://pytorch.org/docs/stable/generated/torch.Tensor.cross.html?highlight=cross#torch.Tensor.cross)
4+
5+
```python
6+
torch.Tensor.cross(other, dim=None)
7+
```
8+
9+
### [paddle.Tensor.cross](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/Tensor_cn.html#cross-y-axis-none-name-none)
10+
11+
```python
12+
paddle.Tensor.cross(y, axis=None, name=None)
13+
```
14+
15+
两者功能一致且参数用法一致,仅参数名不同,具体如下:
16+
17+
### 参数映射
18+
19+
| PyTorch | PaddlePaddle | 备注 |
20+
| ------- | ------------ | -------------------------------------- |
21+
| other | y | 输入 Tensor,仅参数名不同。 |
22+
| dim | axis | 沿此维度进行向量积操作,仅参数名不同。 |
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
## [ 参数完全一致 ]torch.Tensor.cumprod
2+
3+
### [torch.Tensor.cumprod](https://pytorch.org/docs/stable/generated/torch.Tensor.cumprod.html?highlight=cumprod#torch.Tensor.cumprod)
4+
5+
```python
6+
torch.Tensor.cumprod(dim, dtype=None)
7+
```
8+
9+
### [paddle.Tensor.cumprod](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/cumprod_cn.html#cumprod)
10+
11+
```python
12+
paddle.Tensor.cumprod(dim=None, dtype=None, name=None)
13+
```
14+
15+
两者功能一致且参数用法一致, 具体如下:
16+
17+
### 参数映射
18+
19+
| PyTorch | PaddlePaddle | 备注 |
20+
| ------- | ------------ | -------------------------------------------------------------------------------------------------------------------- |
21+
| dim | dim | 指明需要累乘的维度。 |
22+
| dtype | dtype | 返回张量所需的数据类型。dtype 如果指定,则在执行操作之前将输入张量转换为指定的 dtype,这对于防止数据类型溢出很有用。 |
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
## [ 仅参数名不一致 ]torch.Tensor.cumsum
2+
3+
### [torch.Tensor.cumsum](https://pytorch.org/docs/stable/generated/torch.Tensor.cumsum.html?highlight=cumsum#torch.Tensor.cumsum)
4+
5+
```python
6+
torch.Tensor.cumsum(dim, dtype=None)
7+
```
8+
9+
### [paddle.Tensor.cumsum](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/Tensor_cn.html#cumsum-axis-none-dtype-none-name-none)
10+
11+
```python
12+
paddle.Tensor.cumsum(axis=None, dtype=None, name=None)
13+
```
14+
15+
两者功能一致且参数用法一致,仅参数名不同,具体如下:
16+
17+
### 参数映射
18+
19+
| PyTorch | PaddlePaddle | 备注 |
20+
| ------- | ------------ | ------------------------------ |
21+
| dim | axis | 需要累加的维度,仅参数名不同。 |
22+
| dtype | dtype | 输出 Tensor 的数据类型。 |
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
## [ 无参数 ]torch.Tensor.deg2rad
2+
3+
### [torch.Tensor.deg2rad](https://pytorch.org/docs/stable/generated/torch.Tensor.deg2rad.html?highlight=deg2rad#torch.Tensor.deg2rad)
4+
5+
```python
6+
torch.Tensor.deg2rad()
7+
```
8+
9+
### [paddle.Tensor.deg2rad](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/Tensor_cn.html#deg2rad-x-name-none)
10+
11+
```python
12+
paddle.Tensor.deg2rad(name=None)
13+
```
14+
15+
两者功能完全一致,无参数。
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
## [ 参数完全一致 ]torch.Tensor.det
2+
3+
### [torch.Tensor.det](https://pytorch.org/docs/stable/generated/torch.Tensor.det.html?highlight=det#torch.Tensor.det)
4+
5+
```python
6+
torch.Tensor.det()
7+
```
8+
9+
### [paddle.linalg.det](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/linalg/det_cn.html#det)
10+
11+
```python
12+
paddle.linalg.det(x)
13+
```
14+
15+
两者功能参数完全一致,其中 torch 是类成员函数,而 paddle 是非类成员函数,因此输入参数 `x` 不进行对比,具体如下:
16+
17+
### 参数映射
18+
19+
| PyTorch | PaddlePaddle | 备注 |
20+
| ------- | ------------ | ---------------------------------------------------------------------------------------- |
21+
| - | x | 输入一个或批量矩阵。x 的形状应为 [*, M, M],其中 * 为零或更大的批次维度,仅参数名不同。 |
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
## [ 无参数 ]torch.Tensor.detach
2+
3+
### [torch.Tensor.detach](https://pytorch.org/docs/stable/generated/torch.Tensor.detach.html?highlight=detach#torch.Tensor.detach)
4+
5+
```python
6+
torch.Tensor.detach()
7+
```
8+
9+
### [paddle.Tensor.detach](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/Tensor_cn.html#detach)
10+
11+
```python
12+
paddle.Tensor.detach()
13+
```
14+
15+
两者功能完全一致,无参数。
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
## [ 仅参数名不一致 ]torch.Tensor.diag
2+
3+
### [torch.Tensor.diag](https://pytorch.org/docs/stable/generated/torch.Tensor.diag.html?highlight=diag#torch.Tensor.diag)
4+
5+
```python
6+
torch.Tensor.diag(diagonal=0)
7+
```
8+
9+
### [paddle.Tensor.diag](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/diag_cn.html#diag)
10+
11+
```python
12+
paddle.diag(x, offset=0, padding_value=0, name=None)
13+
```
14+
15+
两者功能一致,仅参数名不一致,具体如下:
16+
17+
### 参数映射
18+
19+
| PyTorch | PaddlePaddle | 备注 |
20+
| -------- | ------------- | -------------------------------------------------------------------------------------- |
21+
| - | x | 输入的 Tensor,paddle 参数更多。 |
22+
| diagonal | offset | 考虑的对角线:正值表示上对角线,0 表示主对角线,负值表示下对角线,仅参数名不同。 |
23+
| - | padding_value | 使用此值来填充指定对角线以外的区域,仅在输入为一维 Tensor 时生效,默认值为 0。torch 无此参数,paddle 保持默认即可。 |
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
## [ 参数完全一致 ]torch.Tensor.diagflat
2+
3+
### [torch.Tensor.diagflat](https://pytorch.org/docs/stable/generated/torch.Tensor.diagflat.html?highlight=diagflat#torch.Tensor.diagflat)
4+
5+
```python
6+
torch.Tensor.diagflat(offset=0)
7+
```
8+
9+
### [paddle.diagflat](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/diagflat_cn.html#diagflat)
10+
11+
```python
12+
paddle.diagflat(x, offset=0, name=None)
13+
```
14+
15+
两者功能参数完全一致,其中 torch 是类成员函数,而 paddle 是非类成员函数,因此第一个参数 `x` 不进行对比,其他参数的映射为:
16+
17+
### 参数映射
18+
19+
| PyTorch | PaddlePaddle | 备注 |
20+
| ------- | ------------ | ------------------------------------------------------------------ |
21+
| - | x | 输入的 Tensor,仅参数名不同。 |
22+
| offset | offset | 对角线偏移量。正值表示上对角线,0 表示主对角线,负值表示下对角线。 |

0 commit comments

Comments
 (0)