Skip to content

Commit 4b757b3

Browse files
authored
映射文档 No.48 (#5840)
* 映射文档 No.48 * task 48 * reg * reg * reg * reg * reg * reg * reg
1 parent 4a27d5a commit 4b757b3

File tree

9 files changed

+296
-0
lines changed

9 files changed

+296
-0
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
## [torch 参数更多 ]torch.linalg.matrix_rank
2+
### [torch.linalg.matrix_rank](https://pytorch.org/docs/1.13/generated/torch.linalg.matrix_rank.html?highlight=matrix_rank#torch.linalg.matrix_rank)
3+
```python
4+
torch.linalg.matrix_rank(A, tol=None, hermitian=False, *, out=None)
5+
```
6+
7+
### [paddle.linalg.matrix_rank](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/linalg/matrix_rank_cn.html)
8+
```python
9+
paddle.linalg.matrix_rank(x, tol=None, hermitian=False, name=None)
10+
```
11+
12+
其中 Pytorch 相比 Paddle 支持更多其他参数,具体如下:
13+
### 参数映射
14+
| PyTorch | PaddlePaddle | 备注 |
15+
| ------------- | ------------ | ------------------------------------------------------ |
16+
| A | x | 输入的 Tensor ,仅参数名不同。 |
17+
| tol | tol | 输入的 Tensor 或者 float,参数完全一致。 |
18+
| hermitian | hermitian | 输入的 bool ,参数完全一致。 |
19+
| out | - | 表示输出的 Tensor,PaddlePaddle 无此参数,需要进行转写。 |
20+
21+
22+
### 转写示例
23+
#### out:指定输出
24+
```python
25+
# Pytorch 写法
26+
torch.linalg.matrix_rank(torch.ones(3, 4, 5, 5), tol=0.01, hermitian=True, out=y)
27+
28+
# Paddle 写法
29+
paddle.assign(paddle.linalg.matrix_rank(paddle.ones(shape=[3, 4, 5, 5]), tol=0.01, hermitian=True), y)
30+
```
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
## [torch 参数更多 ]torch.dot
2+
3+
### [torch.dot](https://pytorch.org/docs/1.13/generated/torch.dot.html?highlight=dot#torch.dot)
4+
5+
```python
6+
torch.dot(input, other, *, out=None)
7+
```
8+
9+
### [paddle.dot](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/dot_cn.html#dot)
10+
11+
```python
12+
paddle.dot(x, y, name=None)
13+
```
14+
15+
其中 Pytorch 相比 Paddle 支持更多其他参数,具体如下:
16+
17+
### 参数映射
18+
| PyTorch | PaddlePaddle | 备注 |
19+
| ------------- | ------------ | ------------------------------------------------------ |
20+
| <font color='red'> input </font> | <font color='red'> x </font> | 输入的 Tensor ,仅参数名不同。 |
21+
| <font color='red'> other </font> | <font color='red'> y </font> | 输入的 Tensor ,仅参数名不同。 |
22+
| <font color='red'> out </font> | - | 表示输出的 Tensor,PaddlePaddle 无此参数,需要进行转写。 |
23+
24+
25+
### 转写示例
26+
27+
#### out:指定输出
28+
```python
29+
# Pytorch 写法
30+
torch.dot(torch.tensor([2, 3]), torch.tensor([2, 1]), out=y)
31+
32+
# Paddle 写法
33+
paddle.assign(paddle.dot(paddle.to_tensor([2, 3]), paddle.to_tensor([2, 1])), y)
34+
```
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
## [torch 参数更多 ]torch.ger
2+
3+
### [torch.ger](https://pytorch.org/docs/1.13/generated/torch.ger.html?highlight=ger#torch.ger)
4+
5+
```python
6+
torch.ger(input, vec2, *, out=None)
7+
```
8+
9+
### [paddle.outer](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/outer_cn.html)
10+
11+
```python
12+
paddle.outer(x, y, name=None)
13+
```
14+
15+
其中 Pytorch 相比 Paddle 支持更多其他参数,具体如下:
16+
17+
### 参数映射
18+
| PyTorch | PaddlePaddle | 备注 |
19+
| ------------- | ------------ | ------------------------------------------------------ |
20+
| <font color='red'> input </font> | <font color='red'> x </font> | 输入的 Tensor ,仅参数名不同。 |
21+
| <font color='red'> vec2 </font> | <font color='red'> y </font> | 输入的 Tensor ,仅参数名不同。 |
22+
| <font color='red'> out </font> | - | 表示输出的 Tensor,PaddlePaddle 无此参数,需要进行转写。 |
23+
24+
25+
### 转写示例
26+
27+
#### out:指定输出
28+
```python
29+
# Pytorch 写法
30+
torch.ger([1., 2., 3., 4.], [1., 2., 3.], out=y)
31+
32+
# Paddle 写法
33+
paddle.assign(paddle.outer([1., 2., 3., 4.], [1., 2., 3.]), y)
34+
```
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
## [torch 参数更多 ]torch.inner
2+
3+
### [torch.inner](https://pytorch.org/docs/1.13/generated/torch.inner.html?highlight=inner#torch.inner)
4+
5+
```python
6+
torch.inner(input, other, *, out=None)
7+
```
8+
9+
### [paddle.inner](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/inner_cn.html)
10+
11+
```python
12+
paddle.inner(x, y, name=None)
13+
```
14+
15+
其中 Pytorch 相比 Paddle 支持更多其他参数,具体如下:
16+
17+
### 参数映射
18+
| PyTorch | PaddlePaddle | 备注 |
19+
| ------------- | ------------ | ------------------------------------------------------ |
20+
| <font color='red'> input </font> | <font color='red'> x </font> | 输入的 Tensor ,仅参数名不同。 |
21+
| <font color='red'> other </font> | <font color='red'> y </font> | 输入的 Tensor ,仅参数名不同。 |
22+
| <font color='red'> out </font> | - | 表示输出的 Tensor,PaddlePaddle 无此参数,需要进行转写。 |
23+
24+
25+
### 转写示例
26+
27+
#### out:指定输出
28+
```python
29+
# Pytorch 写法
30+
torch.inner([[1., 2. , 3.], [4. ,5. ,6.]], [[1., 2. , 3.], [4. ,5. ,6.], [7., 8., 9.]], out=y)
31+
32+
# Paddle 写法
33+
paddle.assign(paddle.inner([[1., 2. , 3.], [4. ,5. ,6.]], [[1., 2. , 3.], [4. ,5. ,6.], [7., 8., 9.]]), y)
34+
```
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
## [torch 参数更多 ]torch.inverse
2+
3+
### [torch.inverse](https://pytorch.org/docs/1.13/generated/torch.inverse.html?highlight=inverse#torch.inverse)
4+
5+
```python
6+
torch.inverse(input, *, out=None)
7+
```
8+
9+
### [paddle.linalg.inv](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/linalg/inv_cn.html)
10+
11+
```python
12+
paddle.linalg.inv(x, name=None)
13+
```
14+
15+
其中 Pytorch 相比 Paddle 支持更多其他参数,具体如下:
16+
17+
### 参数映射
18+
| PyTorch | PaddlePaddle | 备注 |
19+
| ------------- | ------------ | ------------------------------------------------------ |
20+
| <font color='red'> input </font> | <font color='red'> x </font> | 输入的 Tensor ,仅参数名不同。 |
21+
| <font color='red'> out </font> | - | 表示输出的 Tensor,PaddlePaddle 无此参数,需要进行转写。 |
22+
23+
24+
### 转写示例
25+
26+
#### out:指定输出
27+
```python
28+
# Pytorch 写法
29+
torch.inverse(torch.tensor([[2., 0.], [0., 2.]]), out=y)
30+
31+
# Paddle 写法
32+
paddle.assign(paddle.inverse(paddle.to_tensor([[2., 0], [0, 2.]])), y)
33+
```
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
## [torch 参数更多 ]torch.lu
2+
3+
### [torch.lu](https://pytorch.org/docs/1.13/generated/torch.lu.html?highlight=lu#torch.lu)
4+
5+
```python
6+
torch.lu(A, pivots=True, get_infos=False, *, out)
7+
```
8+
9+
### [paddle.linalg.lu](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/linalg/lu_cn.html)
10+
11+
```python
12+
paddle.linalg.lu(x, pivot=True, get_infos=False, name=None)
13+
```
14+
15+
其中 Pytorch 相比 Paddle 支持更多其他参数,具体如下:
16+
17+
### 参数映射
18+
| PyTorch | PaddlePaddle | 备注 |
19+
| ------------- | ------------ | ------------------------------------------------------ |
20+
| <font color='red'> A </font> | <font color='red'> x </font> | 输入的 Tensor ,仅参数名不同。 |
21+
| <font color='red'> pivots </font> | <font color='red'> pivot </font> | 输入的 bool ,参数完全一致。 |
22+
| <font color='red'> get_infos </font> | <font color='red'> get_infos </font> | 输入的 bool ,参数完全一致。 |
23+
| <font color='red'> out </font> | - | 表示输出的 Tensor,PaddlePaddle 无此参数,需要进行转写。 |
24+
25+
### 转写示例
26+
27+
#### out:指定输出
28+
```python
29+
# Pytorch 写法
30+
torch.lu(torch.tensor([[1.0, 2.0], [3.0, 4.0], [5.0, 6.0]]), get_infos=True, out=(A_LU, pivots, info))
31+
32+
# Paddle 写法
33+
A_LU, pivots, info = paddle.linalg.lu(paddle.to_tensor([[1.0, 2.0], [3.0, 4.0], [5.0, 6.0]]), get_infos=True)
34+
```
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
## [torch 参数更多 ]torch.lu_unpack
2+
### [torch.lu_unpack](https://pytorch.org/docs/1.13/generated/torch.lu_unpack.html?highlight=lu_unpack#torch.lu_unpack)
3+
4+
```python
5+
torch.lu_unpack(LU_data, LU_pivots, unpack_data=True, unpack_pivots=True, *, out=None)
6+
```
7+
8+
### [paddle.linalg.lu_unpack](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/linalg/lu_unpack_cn.html)
9+
10+
```python
11+
paddle.linalg.lu_unpack(x, y, unpack_ludata=True, unpack_pivots=True, name=None)
12+
```
13+
14+
其中 Pytorch 相比 Paddle 支持更多其他参数,具体如下:
15+
16+
### 参数映射
17+
| PyTorch | PaddlePaddle | 备注 |
18+
| ------------- | ------------ | ------------------------------------------------------ |
19+
| <font color='red'> LU_data </font> | <font color='red'> x </font> | 输入的 Tensor ,仅参数名不同。 |
20+
| <font color='red'> LU_pivots </font> | <font color='red'> y </font> | 输入的 Tensor ,仅参数名不同。 |
21+
| <font color='red'> unpack_data </font> | <font color='red'> unpack_ludata </font> | 输入的 bool ,仅参数名不同。 |
22+
| <font color='red'> unpack_pivots </font> | <font color='red'> unpack_pivots </font> | 输入的 bool ,参数完全一致。 |
23+
| <font color='red'> out </font> | - | 表示输出的 Tensor,PaddlePaddle 无此参数,需要进行转写。 |
24+
25+
### 转写示例
26+
27+
#### out:指定输出
28+
```python
29+
# Pytorch 写法
30+
torch.lu_unpack(*torch.lu(torch.tensor([[1.0, 2.0], [3.0, 4.0], [5.0, 6.0]])), out=(P, L, U))
31+
32+
# Paddle 写法
33+
P,L,U = paddle.linalg.lu_unpack(*paddle.linalg.lu(paddle.to_tensor([[1.0, 2.0], [3.0, 4.0], [5.0, 6.0]])))
34+
```
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
## [torch 参数更多 ]torch.matrix_power
2+
### [torch.matrix_power](https://pytorch.org/docs/1.13/generated/torch.matrix_power.html?highlight=matrix_power)
3+
```python
4+
torch.matrix_power(input, n, *, out=None)
5+
```
6+
7+
### [paddle.linalg.matrix_power](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/linalg/matrix_power_cn.html)
8+
```python
9+
paddle.linalg.matrix_power(x, n, name=None)
10+
```
11+
12+
其中 Pytorch 相比 Paddle 支持更多其他参数,具体如下:
13+
### 参数映射
14+
| PyTorch | PaddlePaddle | 备注 |
15+
| ------------- | ------------ | ------------------------------------------------------ |
16+
| input | x | 输入的 Tensor ,仅参数名不同。 |
17+
| n | n | 输入的 int ,参数完全一致。 |
18+
| out | - | 表示输出的 Tensor,PaddlePaddle 无此参数,需要进行转写。 |
19+
20+
21+
### 转写示例
22+
#### out:指定输出
23+
```python
24+
# Pytorch 写法
25+
torch.matrix_power(torch.tensor([[1., 2., 3.],[1., 4., 9.],[1., 8., 27.]]), 2, out=y)
26+
27+
# Paddle 写法
28+
paddle.assign(paddle.linalg.matrix_power(paddle.to_tensor([[1., 2., 3.],[1., 4., 9.],[1., 8., 27.]]), 2), y)
29+
```
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
## [torch 参数更多 ]torch.outer
2+
3+
### [torch.outer](https://pytorch.org/docs/1.13/generated/torch.outer.html#torch.outer)
4+
5+
```python
6+
torch.outer(input, vec2, *, out=None)
7+
```
8+
9+
### [paddle.outer](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/outer_cn.html)
10+
11+
```python
12+
paddle.outer(x, y, name=None)
13+
```
14+
15+
其中 Pytorch 相比 Paddle 支持更多其他参数,具体如下:
16+
17+
### 参数映射
18+
| PyTorch | PaddlePaddle | 备注 |
19+
| ------------- | ------------ | ------------------------------------------------------ |
20+
| <font color='red'> input </font> | <font color='red'> x </font> | 输入的 Tensor ,仅参数名不同。 |
21+
| <font color='red'> vec2 </font> | <font color='red'> y </font> | 输入的 Tensor ,仅参数名不同。 |
22+
| <font color='red'> out </font> | - | 表示输出的 Tensor,PaddlePaddle 无此参数,需要进行转写。 |
23+
24+
25+
### 转写示例
26+
27+
#### out:指定输出
28+
```python
29+
# Pytorch 写法
30+
torch.outer([1., 2., 3., 4.], [1., 2., 3.], out=y)
31+
32+
# Paddle 写法
33+
paddle.assign(paddle.outer([1., 2., 3., 4.], [1., 2., 3.]), y)
34+
```

0 commit comments

Comments
 (0)