Skip to content

Commit b0e6786

Browse files
authored
映射文档 添加部分 inplace api PART.04 (#6228)
* add 2 1-args inplace api mapping * add 0-args inplace api mapping * add torch.Tensor.renorm_ * add torch.Tensor.multiply_ * add 4 inplace api mapping * update torch.Tensor.arctanh_ * fix errors
1 parent a9fde7a commit b0e6786

26 files changed

+416
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
## [ 无参数 ] torch.Tensor.abs_
2+
3+
### [torch.Tensor.abs_](https://pytorch.org/docs/stable/generated/torch.Tensor.abs_.html)
4+
5+
```python
6+
torch.Tensor.abs_()
7+
```
8+
9+
### [paddle.Tensor.abs_]()
10+
11+
```python
12+
paddle.Tensor.abs_()
13+
```
14+
15+
两者功能一致,无参数。
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
## [ 无参数 ] torch.Tensor.acos_
2+
3+
### [torch.Tensor.acos_](https://pytorch.org/docs/stable/generated/torch.Tensor.acos_.html)
4+
5+
```python
6+
torch.Tensor.acos_()
7+
```
8+
9+
### [paddle.Tensor.acos_]()
10+
11+
```python
12+
paddle.Tensor.acos_()
13+
```
14+
15+
两者功能一致,无参数。
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
## [ 无参数 ] torch.Tensor.acosh_
2+
3+
### [torch.Tensor.acosh_](https://pytorch.org/docs/stable/generated/torch.Tensor.acosh_.html)
4+
5+
```python
6+
torch.Tensor.acosh_()
7+
```
8+
9+
### [paddle.Tensor.acosh_]()
10+
11+
```python
12+
paddle.Tensor.acosh_()
13+
```
14+
15+
两者功能一致,无参数。
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
## [ 无参数 ] torch.Tensor.arccos_
2+
3+
### [torch.Tensor.arccos_](https://pytorch.org/docs/stable/generated/torch.Tensor.arccos_.html)
4+
5+
```python
6+
torch.Tensor.arccos_()
7+
```
8+
9+
### [paddle.Tensor.acos_]()
10+
11+
```python
12+
paddle.Tensor.acos_()
13+
```
14+
15+
两者功能一致,无参数。
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)
4+
5+
```python
6+
torch.Tensor.arccosh_()
7+
```
8+
9+
### [paddle.Tensor.acosh_]()
10+
11+
```python
12+
paddle.Tensor.acosh_()
13+
```
14+
15+
两者功能一致,无参数。
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
## [ 无参数 ] torch.Tensor.arcsin_
2+
3+
### [torch.Tensor.arcsin_](https://pytorch.org/docs/stable/generated/torch.Tensor.arcsin_.html)
4+
5+
```python
6+
torch.Tensor.arcsin_()
7+
```
8+
9+
### [paddle.Tensor.asin_]()
10+
11+
```python
12+
paddle.Tensor.asin_()
13+
```
14+
15+
两者功能一致,无参数。
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
## [ 无参数 ] torch.Tensor.arcsinh_
2+
3+
### [torch.Tensor.arcsinh_](https://pytorch.org/docs/stable/generated/torch.Tensor.arcsinh_.html)
4+
5+
```python
6+
torch.Tensor.arcsinh_()
7+
```
8+
9+
### [paddle.Tensor.asinh_]()
10+
11+
```python
12+
paddle.Tensor.asinh_()
13+
```
14+
15+
两者功能一致,无参数。
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
## [ 无参数 ] torch.Tensor.arctan_
2+
3+
### [torch.Tensor.arctan_](https://pytorch.org/docs/stable/generated/torch.Tensor.arctan_.html)
4+
5+
```python
6+
torch.Tensor.arctan_()
7+
```
8+
9+
### [paddle.Tensor.atan_]()
10+
11+
```python
12+
paddle.Tensor.atan_()
13+
```
14+
15+
两者功能一致,无参数。
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
## [ 无参数 ] torch.Tensor.arctanh_
2+
3+
### [torch.Tensor.arctanh_](https://pytorch.org/docs/stable/generated/torch.Tensor.arctanh_.html)
4+
5+
```
6+
torch.Tensor.arctanh_()
7+
```
8+
9+
### [paddle.Tensor.atanh_]()
10+
11+
```
12+
paddle.Tensor.atanh_()
13+
```
14+
15+
两者功能一致,无参数。
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
## [ 无参数 ] torch.Tensor.asin_
2+
3+
### [torch.Tensor.asin_](https://pytorch.org/docs/stable/generated/torch.Tensor.asin_.html)
4+
5+
```python
6+
torch.Tensor.asin_()
7+
```
8+
9+
### [paddle.Tensor.asin_]()
10+
11+
```python
12+
paddle.Tensor.asin_()
13+
```
14+
15+
两者功能一致,无参数。
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
## [ 无参数 ]torch.Tensor.asinh_
2+
3+
### [torch.Tensor.asinh_](https://pytorch.org/docs/stable/generated/torch.Tensor.asinh_)
4+
5+
```python
6+
torch.Tensor.asinh_()
7+
```
8+
9+
### [paddle.Tensor.asinh_]()
10+
11+
```python
12+
paddle.Tensor.asinh_()
13+
```
14+
15+
两者功能一致,均无参数。
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
## [ 无参数 ] torch.Tensor.atan_
2+
3+
### [torch.Tensor.atan_](https://pytorch.org/docs/stable/generated/torch.Tensor.atan_.html)
4+
5+
```python
6+
torch.Tensor.atan_()
7+
```
8+
9+
### [paddle.Tensor.atan_]()
10+
11+
```python
12+
paddle.Tensor.atan_()
13+
```
14+
15+
两者功能一致,无参数。
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
## [ 无参数 ] torch.Tensor.atanh_
2+
3+
### [torch.Tensor.atanh_](https://pytorch.org/docs/stable/generated/torch.Tensor.atanh_.html#torch.Tensor.atanh_)
4+
5+
```
6+
torch.Tensor.atanh_()
7+
```
8+
9+
### [paddle.Tensor.atanh_]()
10+
11+
```
12+
paddle.Tensor.atanh_()
13+
```
14+
15+
两者功能一致,无参数。
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
## [ 无参数 ] torch.Tensor.cos_
2+
3+
### [torch.Tensor.cos_](https://pytorch.org/docs/stable/generated/torch.Tensor.cos_.html)
4+
5+
```python
6+
torch.Tensor.cos_()
7+
```
8+
9+
### [paddle.Tensor.cos_]()
10+
11+
```python
12+
paddle.Tensor.cos_()
13+
```
14+
15+
两者功能一致,无参数。
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
## [ 无参数 ] torch.Tensor.cosh_
2+
3+
### [torch.Tensor.cosh_](https://pytorch.org/docs/stable/generated/torch.Tensor.cosh_.html)
4+
5+
```python
6+
torch.Tensor.cosh_()
7+
```
8+
9+
### [paddle.Tensor.cosh_]()
10+
11+
```python
12+
paddle.Tensor.cosh_()
13+
```
14+
15+
两者功能一致,无参数。
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
## [ 无参数 ] torch.Tensor.erf_
2+
3+
### [torch.Tensor.erf_](https://pytorch.org/docs/stable/generated/torch.Tensor.erf_.html)
4+
5+
```python
6+
torch.Tensor.erf_()
7+
```
8+
9+
### [paddle.erf_]()
10+
11+
```python
12+
paddle.erf_(x)
13+
```
14+
15+
两者功能一致,无参数。
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
## [ 无参数 ] torch.Tensor.expm1_
2+
3+
### [torch.Tensor.expm1_](https://pytorch.org/docs/stable/generated/torch.Tensor.expm1_.html)
4+
5+
```python
6+
torch.Tensor.expm1_()
7+
```
8+
9+
### [paddle.expm1_]()
10+
11+
```python
12+
paddle.expm1_(x)
13+
```
14+
15+
两者功能一致,无参数。
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
## [ 参数不一致 ] torch.Tensor.multiply_
2+
3+
### [torch.Tensor.multiply_](https://pytorch.org/docs/stable/generated/torch.Tensor.multiply_.html)
4+
5+
```python
6+
torch.Tensor.multiply_(other)
7+
```
8+
9+
### [paddle.Tensor.multiply_]()
10+
11+
```python
12+
paddle.Tensor.multiply_(y,
13+
axis=-1,
14+
name=None)
15+
```
16+
17+
其中,Paddle 与 PyTorch 的 `other` 参数所支持类型不一致,具体如下:
18+
19+
### 参数映射
20+
21+
| PyTorch | PaddlePaddle | 备注 |
22+
| ------------- | ------------ | ----------------------------------------------- |
23+
| other | y | 相乘的元素,PyTorch 支持 Tensor 和 Python Number,Paddle 仅支持 Tensor,需要转写。 |
24+
| - | axis | 计算的维度,PyTorch 无此参数, Paddle 保持默认即可。|
25+
26+
### 转写示例
27+
28+
#### other:相乘的元素
29+
```python
30+
# PyTorch 写法
31+
x.multiply_(other=2)
32+
33+
# Paddle 写法
34+
x.multiply_(y=paddle.to_tensor(2))
35+
```
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
## [ 仅参数名不一致 ]torch.Tensor.renorm_
2+
3+
### [torch.Tensor.renorm_](https://pytorch.org/docs/stable/generated/torch.Tensor.renorm_.html#torch-tensor-renorm_)
4+
5+
```python
6+
torch.Tensor.renorm_(p, dim, maxnorm)
7+
```
8+
9+
### [paddle.Tensor.renorm_]()
10+
11+
```python
12+
paddle.Tensor.renorm_(p, axis, max_norm)
13+
```
14+
15+
两者功能一致,仅参数名不一致,具体如下:
16+
17+
### 参数映射
18+
19+
| PyTorch | PaddlePaddle | 备注 |
20+
| ------- | ------------ | --------------------------------------------------- |
21+
| p | p | 表示 p-范数计算的 p 值。|
22+
| dim | axis | 表示切分的维度,仅参数名不一致。 |
23+
| maxnorm | max_norm | 表示子张量的 p-范数最大值,仅参数名不一致。 |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
## [ 无参数 ] torch.Tensor.sin_
2+
3+
### [torch.Tensor.sin_](https://pytorch.org/docs/stable/generated/torch.Tensor.sin_.html)
4+
5+
```python
6+
torch.Tensor.sin_()
7+
```
8+
9+
### [paddle.Tensor.sin_]()
10+
11+
```python
12+
paddle.Tensor.sin_()
13+
```
14+
15+
两者功能一致,无参数。
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
## [ 无参数 ] torch.Tensor.sinh_
2+
3+
### [torch.Tensor.sinh_](https://pytorch.org/docs/stable/generated/torch.Tensor.sinh_.html)
4+
5+
```python
6+
torch.Tensor.sinh_()
7+
```
8+
9+
### [paddle.Tensor.sinh_]()
10+
11+
```python
12+
paddle.Tensor.sinh_()
13+
```
14+
15+
两者功能一致,无参数。
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
## [ 无参数 ] torch.Tensor.square_
2+
3+
### [torch.Tensor.square_](https://pytorch.org/docs/stable/generated/torch.Tensor.square_.html)
4+
5+
```python
6+
torch.Tensor.square_()
7+
```
8+
9+
### [paddle.square_]()
10+
11+
```python
12+
paddle.square_(x)
13+
```
14+
15+
两者功能一致,无参数。
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
## [ 无参数 ] torch.Tensor.tan_
2+
3+
### [torch.Tensor.tan_](https://pytorch.org/docs/stable/generated/torch.Tensor.tan_.html)
4+
5+
```python
6+
torch.Tensor.tan_()
7+
```
8+
9+
### [paddle.Tensor.tan_]()
10+
11+
```python
12+
paddle.Tensor.tan_()
13+
```
14+
15+
两者功能一致,无参数。

0 commit comments

Comments
 (0)