Skip to content

映射文档 No.70 #5860

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

Merged
merged 6 commits into from
May 25, 2023
Merged
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,50 @@
## [ torch 参数更多 ]torch.Tensor.nanmean

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

```python
torch.Tensor.nanmean(dim=None,
keepdim=False,
dtype=None,
out=None)
```

### [paddle.Tensor.nanmean](暂无对应文档)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个文档bug,可以提issue


```python
paddle.Tensor.nanmean(axis=None,
keepdim=False,
name=None)
```

Pytorch 相比 Paddle 支持更多其他参数,具体如下:
### 参数映射
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
| dim | axis | 表示进行运算的轴,可选项,仅参数名不一致。 |
| keepdim | keepdim | 表示是否保留计算后的维度,可选项。 |
| dtype | - | 指定输出数据类型,可选项,Pytorch 默认值为 None,Paddle 无此参数,需要转写。 |
| out | - | 表示输出的 Tensor,可选项,Paddle 无此参数,需要进行转写。 |

### 转写示例

#### dytpe:指定数据类型

```python
# Pytorch 写法
x.nanmean(dim=-1, dtype=torch.float32,out=y)

# Paddle 写法
x.astype('float32')
paddle.assign(x.nanmean(dim=-1),y)
```

#### out:指定输出

```python
# Pytorch 写法
x.nanmean(dim=1,out=y)

# Paddle 写法
paddle.assign(x.nanmean(dim=1), y)
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
## [ torch 参数更多 ]torch.nn.functional.mish

### [torch.nn.functional.mish](https://pytorch.org/docs/1.13/generated/torch.nn.functional.mish.html?highlight=torch+nn+functional+mish#torch.nn.functional.mish)

```python
torch.nn.functional.mish(input,
inplace=False)
```

### [paddle.nn.functional.mish](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/nn/functional/mish_cn.html)

```python
paddle.nn.functional.mish(x,
name=None)
```

Pytorch 相比 Paddle 支持更多其他参数,具体如下:
### 参数映射
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
| input | x | 表示输入的 Tensor ,仅参数名不一致。 |
| inplace | - | 表示在不更改变量的内存地址的情况下,直接修改变量的值,主要功能为节省显存,一般对网络训练影响不大,Paddle 无此参数,可直接删除。 |
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
## [ torch 参数更多 ]torch.linalg.eig

### [torch.linalg.eig](https://pytorch.org/docs/1.13/generated/torch.linalg.eig.html?highlight=torch+linalg+eig#torch.linalg.eig)

```python
torch.linalg.eig(A,
out=None)
```

### [paddle.linalg.eig](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/linalg/eig_cn.html)

```python
paddle.linalg.eig(x,
name=None)
```

Pytorch 相比 Paddle 支持更多其他参数,具体如下:
### 参数映射
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
| A | x | 表示输入的 Tensor ,仅参数名不一致。 |
| out | - | 表示输出的 tuple, Paddle 无此参数,需要进行转写。 |

### 转写示例

#### out:指定输出

```python
# Pytorch 写法
torch.linalg.eig(t,out=(L,V))

# Paddle 写法
L,V=paddle.linalg.eig(t)
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
## [ torch 参数更多 ]torch.linalg.eigvals

### [torch.linalg.eigvals](https://pytorch.org/docs/1.13/generated/torch.linalg.eigvals.html?highlight=torch+linalg+eigvals#torch.linalg.eigvals)

```python
torch.linalg.eigvals(A,
out=None)
```

### [paddle.linalg.eigvals](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/linalg/eigvals_cn.html)

```python
paddle.linalg.eigvals(x,
name=None)
```

Pytorch 相比 Paddle 支持更多其他参数,具体如下:
### 参数映射
| PyTorch | PaddlePaddle | 备注 |
| ------- | ------------ | ---------------------------------------------------- |
| A | x | 表示输入的 Tensor ,仅参数名不一致。 |
| out | - | 表示输出的 Tensor , Paddle 无此参数,需要进行转写。 |

### 转写示例

#### out:指定输出

```python
# Pytorch 写法
torch.linalg.eigvals(t, out=y)

# Paddle 写法
paddle.assign(paddle.linalg.eigvals(t), y)
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
## [ torch 参数更多 ]torch.linalg.multi_dot

### [torch.linalg.multi_dot](https://pytorch.org/docs/1.13/generated/torch.linalg.multi_dot.html?highlight=torch+linalg+multi_dot#torch.linalg.multi_dot)

```python
torch.linalg.multi_dot(tensors,
out=None)
```

### [paddle.linalg.multi_dot](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/linalg/multi_dot_cn.html)

```python
paddle.linalg.multi_dot(x,
name=None)
```

Pytorch 相比 Paddle 支持更多其他参数,具体如下:
### 参数映射
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
| tensors | x | 表示输入的一个 tensor 列表 ,仅参数名不一致。 |
| out | - | 表示输出的 Tensor , Paddle 无此参数,需要进行转写。 |

### 转写示例

#### out:指定输出

```python
# Pytorch 写法
torch.linalg.multi_dot(x, out=y)

# Paddle 写法
paddle.assign(paddle.linalg.multi_dot(x), y)
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
## [ torch 参数更多 ]troch.nn.Mish

### [troch.nn.Mish](https://pytorch.org/docs/1.13/generated/torch.nn.Mish.html?highlight=troch+nn+mish)

```python
troch.nn.Mish(inplace=False)
```

### [paddle.nn.Mish](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/nn/Mish_cn.html)

```python
paddle.nn.Mish(name=None)
```

Pytorch 相比 Paddle 支持更多其他参数,具体如下:
### 参数映射
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
| inplace | - | 表示在不更改变量的内存地址的情况下,直接修改变量的值,主要功能为节省显存,一般对网络训练影响不大,Paddle 无此参数,可直接删除。 |
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
## [ torch 参数更多 ]torch.frexp

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

```python
torch.frexp(input,
out=None)
```

### [paddle.frexp](暂无对应文档)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

可以提issue报文档bug

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已提交issue


```python
paddle.frexp(x,
name=None)
```

Pytorch 相比 Paddle 支持更多其他参数,具体如下:
### 参数映射
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
| input | x | 表示输入的 Tensor,仅参数名不一致。 |
| out | - | 表示输出的 Tensor,可选项,Paddle 无此参数,需要进行转写。 |

### 转写示例

#### out:指定输出

```python
# Pytorch 写法
torch.frexp(x,out=y)

# Paddle 写法
paddle.assign(paddle.frexp(x), y)
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
## [ torch 参数更多 ]torch.nanmean

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

```python
torch.nanmean(input,
dim=None,
keepdim=False,
dtype=None,
out=None)
```

### [paddle.nanmean](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/nanmean_cn.html)

```python
paddle.nanmean(x,
axis=None,
keepdim=False,
name=None)
```

Pytorch 相比 Paddle 支持更多其他参数,具体如下:
### 参数映射
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
| input | x | 表示输入的 Tensor,仅参数名不一致。 |
| dim | axis | 表示进行运算的轴,可选项,仅参数名不一致。 |
| keepdim | keepdim | 表示是否保留计算后的维度,可选项。 |
| dtype | - | 指定输出数据类型,可选项,Pytorch 默认值为 None,Paddle 无此参数,需要转写。 |
| out | - | 表示输出的 Tensor,可选项,Paddle 无此参数,需要进行转写。 |

### 转写示例

#### dytpe:指定数据类型

```python
# Pytorch 写法
torch.nanmean(x, dim=-1, dtype=torch.float32,out=y)

# Paddle 写法
paddle.assign(paddle.nanmean(x.astype('float32'),dim=-1),y)
```

#### out:指定输出

```python
# Pytorch 写法
torch.nanmean(t, dim=1,out=y)

# Paddle 写法
paddle.assign(paddle.nanmean(t, dim=1), y)
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
## [ torch 参数更多 ]torch.take_along_dim

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

```python
torch.take_along_dim(input,
indices,
dim,
out=None)
```

### [paddle.take_along_axis](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/take_along_axis_cn.html)

```python
paddle.take_along_axis(arr,
indices,
axis)
```

Pytorch 相比 Paddle 支持更多其他参数,具体如下:
### 参数映射
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
| input | arr | 表示输入的 Tensor ,仅参数名不一致。 |
| indices | indices | 表示索引矩阵 ,仅参数名不一致。 |
| dim | axis | 表示沿着哪个维度获取对应的值,仅参数名不一致。 |
| out | - | 表示输出的 Tensor , Paddle 无此参数,需要进行转写。 |

### 转写示例

#### out:指定输出

```python
# Pytorch 写法
torch.take_along_dim(t, idx, 1,out=y)

# Paddle 写法
paddle.assign(paddle.take_along_axis(t, idx, 1), y)
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
## [ torch 参数更多 ]torch.special.erf

### [torch.special.erf](https://pytorch.org/docs/1.13/special.html?highlight=torch+special+erf#torch.special.erf)

```python
torch.special.erf(input,
out=None)
```

### [paddle.erf](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/erf_cn.html)

```python
paddle.erf(x,
name=None)
```

Pytorch 相比 Paddle 支持更多其他参数,具体如下:
### 参数映射
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
| input | x | 表示输入的 Tensor ,仅参数名不一致。 |
| out | - | 表示输出的 Tensor , Paddle 无此参数,需要进行转写。 |

### 转写示例

#### out:指定输出

```python
# Pytorch 写法
torch.special.erf(t, out=y)

# Paddle 写法
paddle.assign(paddle.erf(t), y)
```