Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

映射文档 No.17 #5755

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
## [ 仅paddle参数更多 ] torch.Tensor.mul

### [torch.Tensor.mul](https://pytorch.org/docs/1.13/generated/torch.Tensor.mul.html)

```python
torch.Tensor.mul(value)
```

### [paddle.Tensor.multiply](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/Tensor_cn.html#multiply-y-axis-1-name-none)

```python
paddle.Tensor.multiply(y,
axis=-1,
name=None)
```

两者功能一致,输入一个y ,将 Tensor 与 y 的对应元素相乘。其中 Paddle 相比 PyTorch 支持更多其他参数,具体如下:

### 参数映射
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
| value | y | 相乘的矩阵 |
| - | axis | 计算的维度,PyTorch 无此参数, Paddle 设为 -1 即可



Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
## [ 仅paddle参数更多 ] torch.Tensor.mul_
### [torch.Tensor.mul_](https://pytorch.org/docs/1.13/generated/torch.Tensor.mul_.html?highlight=mul_)

```python
torch.Tensor.mul_(value)
```

### [paddle.Tensor.scale_](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/Tensor_cn.html#id16)

```python
paddle.Tensor.scale_(scale=1.0,
bias=0.0,
bias_after_scale=True,
act=None,
name=None)
```
两者功能一致,输入一个常数value(scale),将矩阵x放大value(scale)倍,需要将bias设置为0.0。其中 Paddle 相比 PyTorch 支持更多其他参数,具体如下:

### 参数映射
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
| value | scale | 放缩的大小 |
| - | bias | 表示放缩后的偏置部分,PyTorch 无此参数, Paddle 设为 0.0 即可 |
| - | bias_after_scale | 表示是否在放缩后加偏置部分,PyTorch 无此参数, Paddle 设为 True 即可 |

Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
## [ 仅paddle参数更多 ] torch.Tensor.multiply

### [torch.Tensor.multiply](https://pytorch.org/docs/1.13/generated/torch.Tensor.multiply.html)

```python
torch.Tensor.multiply(value)
```

### [paddle.Tensor.multiply](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/Tensor_cn.html#multiply-y-axis-1-name-none)

```python
paddle.Tensor.multiply(y,
axis=-1,
name=None)
```

两者功能一致,输入一个y ,将 Tensor 与 y 的对应元素相乘。其中 Paddle 相比 PyTorch 支持更多其他参数,具体如下:

### 参数映射
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
| value | y | 相乘的矩阵 |
| - | axis | 计算的维度,PyTorch 无此参数, Paddle 设为 -1 即可 |
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
## [ 仅paddle参数更多 ] torch.Tensor.mulmultiply_

### [torch.Tensor.multiply_](https://pytorch.org/docs/1.13/generated/torch.Tensor.multiply_.html?highlight=multiply#torch.Tensor.multiply_)

```python
torch.Tensor.multiply_(value)
```

### [paddle.Tensor.scale_](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/Tensor_cn.html#id16)

```python
paddle.Tensor.scale_(scale=1.0,
bias=0.0,
bias_after_scale=True,
act=None,
name=None)
```

两者功能一致,输入一个常数value(scale),将矩阵x放大value(scale)倍,需要将bias设置为0.0。其中 Paddle 相比 PyTorch 支持更多其他参数,具体如下:
### 参数映射
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
| value | scale | 放缩的大小 |
| - | bias | 表示放缩后的偏置部分,PyTorch 无此参数, Paddle 设为 0.0 即可 |
| - | bias_after_scale | 表示是否在放缩后加偏置部分,PyTorch 无此参数, Paddle 设为 True 即可 |


Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
## [ 一致的参数 ] torch.Tensor.mv
### [torch.Tensor.mv](https://pytorch.org/docs/1.13/generated/torch.Tensor.mv.html)

```python
torch.Tensor.mv(vec)
```

### [paddle.Tensor.mv](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/mv_cn.html)

```python
paddle.Tensor.mv(vec)
```

两者功能一致,计算 Tensor 和向量 vec 的乘积。

### 参数映射
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
| vec | vec | 相乘的向量 |
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
## [ 一致的参数 ] torch.Tensor.nansum
### [torch.Tensor.nansum](https://pytorch.org/docs/1.13/generated/torch.Tensor.nansum.html?highlight=nansum#torch.Tensor.nansum)

```python
Tensor.nansum(dim=None,
keepdim=False,
dtype=None)
```

### [paddle.Tensor.nansum](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/index_cn.html)未找到文档

```python
paddle.Tensor.nansum(axis=None,
keepdim=False,
dtype=None)
```

两者功能一致,返回 Tensor 中元素的和,其中nan值记为0

### 参数映射
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
| dim | axis | 需要求和的维度 |
| keepdim | keepdim | 结果是否需要保持维度不变 |
| dtype | dtype | 返回的Tensor的类型 |

Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
## [ 无参数 ] torch.Tensor.ndimension

### [torch.Tensor.ndimension](https://pytorch.org/docs/1.13/generated/torch.Tensor.ndimension.html?highlight=ndimension#torch.Tensor.ndimension)

```python
torch.Tensor.ndimension()
```

### [paddle.Tensor.ndimension](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/Tensor_cn.html#ndimension)

```python
paddle.Tensor.ndimension()
```

两者功能一致,均无参数,查看一个 Tensor 的维度。
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
## [ 一致的参数 ] torch.Tensor.ne
### [torch.Tensor.ne](https://pytorch.org/docs/1.13/generated/torch.Tensor.ne.html?highlight=ne)

```python
torch.Tensor.ne(other)
```

### [paddle.Tensor.not_equal](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/not_equal_cn.html)

```python
paddle.Tensor.not_equal(y)
```

两者功能一致,逐元素比较 Tensor 和 y 是否相等,相同位置的元素不相同则返回 True,否则返回 False。
### 参数映射
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
| other | y | 比较的矩阵 |

Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
## [ 无参数 ] torch.Tensor.neg

### [torch.Tensor.neg](https://pytorch.org/docs/1.13/generated/torch.Tensor.neg.html?highlight=neg#torch.Tensor.neg)

```python
torch.Tensor.neg()
```

### [paddle.Tensor.neg](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/Tensor_cn.html#neg-name-none)

```python
paddle.Tensor.neg()
```

两者功能一致,均无参数,将 Tensor 上的各个值取相反数。
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
## [ 一致的参数 ] torch.Tensor.not_equal
### [torch.Tensor.not_equal](https://pytorch.org/docs/1.13/generated/torch.Tensor.not_equal.html)

```python
torch.Tensor.not_equal(other)
```

### [paddle.Tensor.not_equal](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/not_equal_cn.html)

```python
paddle.Tensor.not_equal(y)
```


两者功能一致,逐元素比较 Tensor 和 y 是否相等,相同位置的元素不相同则返回 True,否则返回 False。
### 参数映射
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
| other | y | 被比较的矩阵 |