Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
X2Paddle
提交
2e848d63
X
X2Paddle
项目概览
PaddlePaddle
/
X2Paddle
大约 1 年 前同步成功
通知
328
Star
698
Fork
167
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
26
列表
看板
标记
里程碑
合并请求
4
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
X2Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
26
Issue
26
列表
看板
标记
里程碑
合并请求
4
合并请求
4
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
2e848d63
编写于
6月 10, 2021
作者:
S
SunAhong1993
提交者:
GitHub
6月 10, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
添加API映射文档 (#616)
* Update stargan.md * fix the paddle_type * add docs * add docs
上级
54bb8ebd
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
279 addition
and
0 deletion
+279
-0
docs/pytorch_project_convertor/API_docs/ops/README.md
docs/pytorch_project_convertor/API_docs/ops/README.md
+51
-0
docs/pytorch_project_convertor/API_docs/ops/torch.diag.md
docs/pytorch_project_convertor/API_docs/ops/torch.diag.md
+16
-0
docs/pytorch_project_convertor/API_docs/ops/torch.kthvalue.md
.../pytorch_project_convertor/API_docs/ops/torch.kthvalue.md
+23
-0
docs/pytorch_project_convertor/API_docs/ops/torch.rot90.md
docs/pytorch_project_convertor/API_docs/ops/torch.rot90.md
+22
-0
docs/pytorch_project_convertor/API_docs/ops/torch.std_mean.md
.../pytorch_project_convertor/API_docs/ops/torch.std_mean.md
+24
-0
docs/pytorch_project_convertor/API_docs/ops/torch.sub.md
docs/pytorch_project_convertor/API_docs/ops/torch.sub.md
+23
-0
docs/pytorch_project_convertor/API_docs/ops/torch.subtract.md
.../pytorch_project_convertor/API_docs/ops/torch.subtract.md
+23
-0
docs/pytorch_project_convertor/API_docs/ops/torch.unique.md
docs/pytorch_project_convertor/API_docs/ops/torch.unique.md
+73
-0
docs/pytorch_project_convertor/API_docs/ops/torch.var_mean.md
.../pytorch_project_convertor/API_docs/ops/torch.var_mean.md
+24
-0
未找到文件。
docs/pytorch_project_convertor/API_docs/ops/README.md
浏览文件 @
2e848d63
...
...
@@ -90,5 +90,56 @@
| 85 |
[
torch.argmin
](
https://pytorch.org/docs/stable/generated/torch.argmin.html?highlight=argmin#torch.argmin
)
|
[
paddle.argmin
](
https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/argmin_cn.html#argmin
)
| 功能一致,参数名不一致 |
| 86 |
[
torch.max
](
https://pytorch.org/docs/stable/generated/torch.max.html?highlight=max#torch.max
)
|
[
paddle.max
](
https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/max_cn.html#max
)
| 功能一致,参数名不一致,PaddlePaddle未定义
`out`
参数代表输出Tensor |
| 87 |
[
torch.min
](
https://pytorch.org/docs/stable/generated/torch.min.html?highlight=min#torch.min
)
|
[
paddle.min
](
https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/min_cn.html#min
)
| 功能一致,参数名不一致,PaddlePaddle未定义
`out`
参数代表输出Tensor |
| 88 |
[
torch.square
](
https://pytorch.org/docs/stable/generated/torch.square.html?highlight=square#torch.square
)
|
[
paddle.square
](
https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/square_cn.html#square
)
| 功能一致,参数名不一致,PaddlePaddle未定义
`out`
参数代表输出Tensor |
| 89 |
[
torch.sub
](
https://pytorch.org/docs/stable/generated/torch.sub.html?highlight=sub#torch.sub
)
|
[
paddle.subtract
](
https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/subtract_cn.html#subtract
)
|
[
差异对比
](
./torch.sub.md
)
|
| 90 |
[
torch.subtract
](
https://pytorch.org/docs/stable/generated/torch.subtract.html?highlight=subtract#torch.subtract
)
|
[
paddle.subtract
](
https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/subtract_cn.html#subtract
)
|
[
差异对比
](
./torch.subtract.md
)
|
| 91 |
[
torch.tanh
](
https://pytorch.org/docs/stable/generated/torch.tanh.html?highlight=tanh#torch.tanh
)
|
[
paddle.tanh
](
https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/tanh_cn.html#tanh
)
| 功能一致,参数名不一致,PaddlePaddle未定义
`out`
参数代表输出Tensor |
| 92 |
[
torch.true_divide
](
https://pytorch.org/docs/stable/generated/torch.true_divide.html?highlight=true_divide#torch.true_divide
)
|
[
paddle.divide
](
https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/divide_cn.html#divide
)
| 功能一致,参数名不一致,PaddlePaddle未定义
`out`
参数代表输出Tensor |
| 93 |
[
torch.dist
](
https://pytorch.org/docs/stable/generated/torch.dist.html?highlight=dist
)
|
[
paddle.dist
](
https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/dist_cn.html#dist
)
| 功能一致,参数名不一致 |
| 94 |
[
torch.logsumexp
](
https://pytorch.org/docs/stable/generated/torch.logsumexp.html?highlight=logsumexp#torch.logsumexp
)
|
[
paddle.logsumexp
](
https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/logsumexp_cn.html#logsumexp
)
| 功能一致,参数名不一致,PaddlePaddle未定义
`out`
参数代表输出Tensor |
| 95 |
[
torch.mean
](
https://pytorch.org/docs/stable/generated/torch.mean.html?highlight=mean
)
|
[
paddle.mean
](
https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/mean_cn.html#mean
)
| 功能一致,参数名不一致,PaddlePaddle未定义
`out`
参数代表输出Tensor |
| 96 |
[
torch.median
](
https://pytorch.org/docs/stable/generated/torch.median.html?highlight=median#torch.median
)
|
[
paddle.median
](
https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/median_cn.html#median
)
| 功能一致,参数名不一致,PaddlePaddle未定义
`out`
参数代表输出Tensor |
| 97 |
[
torch.norm
](
https://pytorch.org/docs/stable/generated/torch.norm.html?highlight=norm#torch.norm
)
|
[
paddle.norm
](
https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/norm_cn.html#norm
)
| 功能一致,参数名不一致,PaddlePaddle未定义
`out`
参数代表输出Tensor以及
`dtype`
参数代表输出Tensor类型 |
| 98 |
[
torch.prod
](
https://pytorch.org/docs/stable/generated/torch.prod.html?highlight=prod#torch.prod
)
|
[
paddle.prod
](
https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/prod_cn.html#prod
)
| 功能一致,参数名不一致,PaddlePaddle未定义
`out`
参数代表输出Tensor |
| 99 |
[
torch.std
](
https://pytorch.org/docs/stable/generated/torch.std.html?highlight=std#torch.std
)
|
[
paddle.std
](
https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/std_cn.html#std
)
| 功能一致,参数名不一致,PaddlePaddle未定义
`out`
参数代表输出Tensor |
| 100 |
[
torch.std_mean
](
https://pytorch.org/docs/stable/generated/torch.std_mean.html?highlight=std_mean#torch.std_mean
)
| 无对应实现 |
[
组合实现
](
./torch.std_mean.md
)
|
| 101 |
[
torch.sum
](
https://pytorch.org/docs/stable/generated/torch.sum.html?highlight=sum#torch.sum
)
|
[
paddle.sum
](
https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/sum_cn.html#sum
)
| 功能一致,参数名不一致 |
| 102 |
[
torch.unique
](
https://pytorch.org/docs/stable/generated/torch.unique.html?highlight=unique#torch.unique
)
|
[
paddle.unique
](
https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/unique_cn.html#unique
)
|
[
差异对比
](
./torch.unique.md
)
|
| 103 |
[
torch.var
](
https://pytorch.org/docs/stable/generated/torch.var.html?highlight=var#torch.var
)
|
[
paddle.var
](
https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/var_cn.html
)
| 功能一致,参数名不一致,PaddlePaddle未定义
`out`
参数代表输出Tensor |
| 104 |
[
torch.var_mean
](
https://pytorch.org/docs/stable/generated/torch.var_mean.html?highlight=var_mean#torch.var_mean
)
| 无对应实现 |
[
组合实现
](
./torch.var_mean.md
)
|
| 105 |
[
torch.allclose
](
https://pytorch.org/docs/stable/generated/torch.allclose.html?highlight=allclose#torch.allclose
)
|
[
paddle.allclose
](
https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/allclose_cn.html
)
| 功能一致,参数名不一致 |
| 106 |
[
torch.argsort
](
https://pytorch.org/docs/stable/generated/torch.argsort.html?highlight=argsort#torch.argsort
)
|
[
paddle.argsort
](
https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/argsort_cn.html
)
| 功能一致,参数名不一致 |
| 107 |
[
torch.eq
](
https://pytorch.org/docs/stable/generated/torch.eq.html?highlight=eq#torch.eq
)
|
[
paddle.equal
](
https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/equal_cn.html
)
| 功能一致,参数名不一致,PaddlePaddle未定义
`out`
参数代表输出Tensor |
| 108 |
[
torch.equal
](
https://pytorch.org/docs/stable/generated/torch.equal.html?highlight=eq#torch.equal
)
|
[
paddle.equal_all
](
https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/equal_all_cn.html
)
| 功能一致,参数名不一致 |
| 109 |
[
torch.ge
](
https://pytorch.org/docs/stable/generated/torch.ge.html?highlight=ge#torch.ge
)
|
[
paddle.greater_equal
](
https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/greater_equal_cn.html
)
| 功能一致,参数名不一致,PaddlePaddle未定义
`out`
参数代表输出Tensor |
| 110 |
[
torch.gt
](
https://pytorch.org/docs/stable/generated/torch.gt.html?highlight=gt#torch.gt
)
|
[
paddle.greater_than
](
https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/greater_than_cn.html
)
| 功能一致,参数名不一致,PaddlePaddle未定义
`out`
参数代表输出Tensor |
| 111 |
[
torch.isfinite
](
https://pytorch.org/docs/stable/generated/torch.isfinite.html?highlight=isfinite#torch.isfinite
)
|
[
paddle.isfinite
](
https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/isfinite_cn.html
)
| 功能一致,参数名不一致 |
| 112 |
[
torch.isinf
](
https://pytorch.org/docs/stable/generated/torch.isinf.html?highlight=isinf#torch.isinf
)
|
[
paddle.isinf
](
https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/isinf_cn.html
)
| 功能一致,参数名不一致 |
| 113 |
[
torch.isnan
](
https://pytorch.org/docs/stable/generated/torch.isnan.html?highlight=isnan#torch.isnan
)
|
[
paddle.isnan
](
https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/isnan_cn.html
)
| 功能一致,参数名不一致 |
| 114 |
[
torch.kthvalue
](
https://pytorch.org/docs/stable/generated/torch.kthvalue.html?highlight=kthvalue#torch.kthvalue
)
| 无对应实现 |
[
组合实现
](
./torch.kthvalue.md
)
|
| 115 |
[
torch.le
](
https://pytorch.org/docs/stable/generated/torch.le.html?highlight=le#torch.le
)
|
[
paddle.less_equal
](
https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/less_equal_cn.html
)
| 功能一致,参数名不一致,PaddlePaddle未定义
`out`
参数代表输出Tensor |
| 116 |
[
torch.lt
](
https://pytorch.org/docs/stable/generated/torch.lt.html?highlight=lt#torch.lt
)
|
[
paddle.less_than
](
https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/less_than_cn.html
)
| 功能一致,参数名不一致,PaddlePaddle未定义
`out`
参数代表输出Tensor |
| 117 |
[
torch.maximum
](
https://pytorch.org/docs/stable/generated/torch.maximum.html?highlight=max#torch.maximum
)
|
[
paddle.maximum
](
https://www.paddlepaddle.org.cn/documentation/docs/zh/2.0/api/paddle/tensor/math/maximum_cn.html#cn-api-paddle-tensor-maximum
)
| 功能一致,参数名不一致,PaddlePaddle未定义
`out`
参数代表输出Tensor |
| 118 |
[
torch.minimum
](
https://pytorch.org/docs/stable/generated/torch.minimum.html?highlight=minimum#torch.minimum
)
|
[
paddle.minimum
](
https://www.paddlepaddle.org.cn/documentation/docs/zh/2.0/api/paddle/tensor/math/minimum_cn.html#cn-api-paddle-tensor-minimum
)
| 功能一致,参数名不一致,PaddlePaddle未定义
`out`
参数代表输出Tensor |
| 119 |
[
torch.ne
](
https://pytorch.org/docs/stable/generated/torch.ne.html?highlight=ne#torch.ne
)
|
[
paddle.not_equal
](
https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/not_equal_cn.html
)
| 功能一致,参数名不一致,PaddlePaddle未定义
`out`
参数代表输出Tensor |
| 120 |
[
torch.sort
](
https://pytorch.org/docs/stable/generated/torch.sort.html?highlight=sort#torch.sort
)
|
[
paddle.argsort
](
https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/argsort_cn.html
)
| 功能一致,参数名不一致,PaddlePaddle未定义
`out`
参数代表输出Tensor |
| 121 |
[
torch.topk
](
https://pytorch.org/docs/stable/generated/torch.topk.html?highlight=topk#torch.topk
)
|
[
paddle.topk
](
https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/topk_cn.html#topk
)
| 功能一致,参数名不一致,PaddlePaddle未定义
`out`
参数代表输出Tensor |
| 122 |
[
torch.cross
](
https://pytorch.org/docs/stable/generated/torch.cross.html?highlight=cross#torch.cross
)
|
[
paddle.cross
](
https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/cross_cn.html
)
| 功能一致,参数名不一致,PaddlePaddle未定义
`out`
参数代表输出Tensor |
| 123 |
[
torch.any
](
https://pytorch.org/docs/stable/generated/torch.any.html?highlight=any#torch.any
)
|
[
paddle.any
](
https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/any_cn.html
)
| 功能一致,参数名不一致,PaddlePaddle未定义
`out`
参数代表输出Tensor |
| 124 |
[
torch.cumsum
](
https://pytorch.org/docs/stable/generated/torch.cumsum.html?highlight=cumsum#torch.cumsum
)
|
[
paddle.cumsum
](
https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/cumsum_cn.html
)
| 功能一致,参数名不一致,PaddlePaddle未定义
`out`
参数代表输出Tensor |
| 125 |
[
torch.diag
](
https://pytorch.org/docs/stable/generated/torch.diag.html?highlight=diag#torch.diag
)
|
[
paddle.diag
](
https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/diag_cn.html
)
|
[
差异对比
](
./torch.diag.md
)
|
| 126 |
[
torch.diag_embed
](
https://pytorch.org/docs/stable/generated/torch.diag_embed.html?highlight=diag_embed#torch.diag_embed
)
|
[
paddle.nn.functional.diag_embed
](
https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/nn/functional/diag_embed_cn.html
)
| 功能一致 |
| 127 |
[
torch.einsum
](
https://pytorch.org/docs/stable/generated/torch.einsum.html?highlight=einsum#torch.einsum
)
| paddlenlp.ops.einsum | 功能一致,需要安装
[
paddlenlp
](
https://github.com/PaddlePaddle/PaddleNLP#pip%E5%AE%89%E8%A3%85
)
|
| 128 |
[
torch.flatten
](
https://pytorch.org/docs/stable/generated/torch.flatten.html?highlight=flatten#torch.flatten
)
|
[
paddle.flatten
](
https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/flatten_cn.html
)
| 功能一致,参数名不一致 |
| 129 |
[
torch.flip
](
https://pytorch.org/docs/stable/generated/torch.flip.html?highlight=flip#torch.flip
)
|
[
paddle.flip
](
https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/flip_cn.html
)
| 功能一致,参数名不一致 |
| 130 |
[
torch.rot90
](
https://pytorch.org/docs/stable/generated/torch.rot90.html?highlight=rot90#torch.rot90
)
| 无对应实现 |
[
组合实现
](
./torch.rot90.md
)
|
| 131 |
[
torch.meshgrid
](
https://pytorch.org/docs/stable/generated/torch.meshgrid.html?highlight=meshgrid#torch.meshgrid
)
|
[
paddle.meshgrid
](
https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/meshgrid_cn.html
)
| 功能一致 |
| 132 |
[
torch.roll
](
https://pytorch.org/docs/stable/generated/torch.roll.html?highlight=roll#torch.roll
)
|
[
paddle.roll
](
https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/roll_cn.html
)
| 功能一致,参数名不一致 |
| 133 |
[
torch.tril
](
https://pytorch.org/docs/stable/generated/torch.tril.html?highlight=tril#torch.tril
)
|
[
paddle.tril
](
https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/tril_cn.html
)
| 功能一致,参数名不一致,PaddlePaddle未定义
`out`
参数代表输出Tensor |
| 134 |
[
torch.triu
](
https://pytorch.org/docs/stable/generated/torch.triu.html?highlight=triu#torch.triu
)
|
[
paddle.triu
](
https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/triu_cn.html
)
| 功能一致,参数名不一致,PaddlePaddle未定义
`out`
参数代表输出Tensor |
| 135 |
[
torch.bmm
](
https://pytorch.org/docs/stable/generated/torch.bmm.html?highlight=bmm#torch.bmm
)
|
[
paddle.bmm
](
https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/bmm_cn.html
)
| 功能一致,参数名不一致,PaddlePaddle未定义
`out`
参数代表输出Tensor |
| 136 |
[
torch.cholesky
](
https://pytorch.org/docs/stable/generated/torch.cholesky.html?highlight=cholesky#torch.cholesky
)
|
[
paddle.cholesky
](
https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/cholesky_cn.html
)
| 功能一致,参数名不一致,PaddlePaddle未定义
`out`
参数代表输出Tensor |
| 137 |
[
torch.dot
](
https://pytorch.org/docs/stable/generated/torch.dot.html?highlight=dot#torch.dot
)
|
[
paddle.dot
](
https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/dot_cn.html
)
| 功能一致,参数名不一致,PaddlePaddle未定义
`out`
参数代表输出Tensor |
| 138 |
[
torch.inverse
](
https://pytorch.org/docs/stable/generated/torch.inverse.html?highlight=inverse#torch.inverse
)
|
[
paddle.inverse
](
https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/inverse_cn.html
)
| 功能一致,参数名不一致,PaddlePaddle未定义
`out`
参数代表输出Tensor |
***持续更新...**
*
docs/pytorch_project_convertor/API_docs/ops/torch.diag.md
0 → 100644
浏览文件 @
2e848d63
## torch.diag
### [torch.diag](https://pytorch.org/docs/stable/generated/torch.diag.html?highlight=diag#torch.diag)
```
python
torch
.
diag
(
input
,
diagonal
=
0
,
*
,
out
=
None
)
```
### [paddle.diag](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/diag_cn.html)
```
python
paddle
.
diag
(
x
,
offset
=
0
,
padding_value
=
0
,
name
=
None
)
```
### 参数差异
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
| input | x | 表示输出的Tensor。 |
| diagonal | offset | 对角线偏移量。正值表示上对角线,0表示主对角线,负值表示下对角线。 |
| - | padding_value | 表示填充指定对角线以外的区域,PyTorch无此参数,其用0填充。 |
docs/pytorch_project_convertor/API_docs/ops/torch.kthvalue.md
0 → 100644
浏览文件 @
2e848d63
## torch.kthvalue
### [torch.kthvalue](https://pytorch.org/docs/stable/generated/torch.kthvalue.html?highlight=kthvalue#torch.kthvalue)
```
python
torch
.
kthvalue
(
input
,
k
,
dim
=
None
,
keepdim
=
False
,
out
=
None
)
```
### 功能介绍
用于获取某一维度上第k大的数值,PaddlePaddle目前无对应API,可使用如下代码组合实现该API。
```
python
import
paddle
def
kthvalue
(
input
,
k
,
dim
=
None
,
keepdim
=
False
,
out
=
None
):
values
=
paddle
.
sort
(
input
,
axis
=
dim
)
indices
=
paddle
.
argsort
(
input
,
axis
=
dim
)
values
=
paddle
.
slice
(
values
,
axes
=
[
dim
],
starts
=
[
k
-
1
],
ends
=
[
k
])
indices
=
paddle
.
slice
(
indices
,
axes
=
[
dim
],
starts
=
[
k
-
1
],
ends
=
[
k
])
if
not
keepdim
:
values
=
paddle
.
flatten
(
values
)
indices
=
paddle
.
flatten
(
indices
)
return
values
,
indices
```
docs/pytorch_project_convertor/API_docs/ops/torch.rot90.md
0 → 100644
浏览文件 @
2e848d63
## torch.rot90
### [torch.rot90](https://pytorch.org/docs/stable/generated/torch.rot90.html?highlight=rot90#torch.rot90)
```
python
torch
.
rot90
(
input
,
k
,
dims
)
```
### 功能介绍
用于实现对矩阵进行k次90度旋转,PaddlePaddle目前无对应API,可使用如下代码组合实现该API。
```
python
import
paddle
def
rot90
(
input
,
k
,
dims
):
l
=
len
(
input
.
shape
)
new_dims
=
list
(
range
(
l
))
new_dims
[
dims
[
0
]]
=
dims
[
1
]
new_dims
[
dims
[
1
]]
=
dims
[
0
]
flip_dim
=
min
(
dims
)
for
i
in
range
(
k
):
input
=
paddle
.
transpose
(
input
,
new_dims
)
input
=
paddle
.
flip
(
input
,
[
flip_dim
])
return
input
```
\ No newline at end of file
docs/pytorch_project_convertor/API_docs/ops/torch.std_mean.md
0 → 100644
浏览文件 @
2e848d63
## torch.std_mean
### [torch.std_mean](https://pytorch.org/docs/stable/generated/torch.std_mean.html?highlight=std_mean#torch.std_mean)
```
python
# 用法一:
torch
.
std_mean
(
input
,
unbiased
=
True
)
# 用法二:
torch
.
std_mean
(
input
,
dim
,
unbiased
=
True
,
keepdim
=
False
)
```
### 功能介绍
用于实现返回Tensor的标准差和均值,PaddlePaddle目前无对应API,可使用如下代码组合实现该API。
```
python
import
paddle
def
std_mean
(
input
,
dim
=
None
,
unbiased
=
True
,
keepdim
=
False
):
std
=
paddle
.
std
(
input
,
axis
=
dim
,
unbiased
=
unbiased
,
keepdim
=
keepdim
)
mean
=
paddle
.
mean
(
input
,
axis
=
dim
,
keepdim
=
keepdim
)
return
std
,
mean
```
docs/pytorch_project_convertor/API_docs/ops/torch.sub.md
0 → 100644
浏览文件 @
2e848d63
## torch.sub
### [torch.sub](https://pytorch.org/docs/stable/generated/torch.sub.html?highlight=torch%20sub#torch.sub)
```
python
torch
.
sub
(
input
,
other
,
*
,
alpha
=
1
,
out
=
None
)
```
### [paddle.subtract](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/subtract_cn.html#subtract)
```
python
paddle
.
subtract
(
x
,
y
,
name
=
None
)
```
### 参数差异
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
| alpha | - | 表示
`other`
的乘数,PaddlePaddle无此参数。 |
| out | - | 表示输出的Tensor,PaddlePaddle无此参数。 |
### 功能差异
#### 计算差异
***PyTorch**
*
:
$ out = input - alpha
*
other $
***PaddlePaddle**
*
:
$ out = x - y $
\ No newline at end of file
docs/pytorch_project_convertor/API_docs/ops/torch.subtract.md
0 → 100644
浏览文件 @
2e848d63
## torch.subtract
### [torch.subtract](https://pytorch.org/docs/stable/generated/torch.subtract.html?highlight=subtract#torch.subtract)
```
python
torch
.
subtract
(
input
,
other
,
*
,
alpha
=
1
,
out
=
None
)
```
### [paddle.subtract](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/subtract_cn.html#subtract)
```
python
paddle
.
subtract
(
x
,
y
,
name
=
None
)
```
### 参数差异
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
| alpha | - | 表示
`other`
的乘数,PaddlePaddle无此参数。 |
| out | - | 表示输出的Tensor,PaddlePaddle无此参数。 |
### 功能差异
#### 计算差异
***PyTorch**
*
:
$ out = input - alpha
*
other $
***PaddlePaddle**
*
:
$ out = x - y $
\ No newline at end of file
docs/pytorch_project_convertor/API_docs/ops/torch.unique.md
0 → 100644
浏览文件 @
2e848d63
## torch.unique
### [torch.unique](https://pytorch.org/docs/stable/generated/torch.unique.html?highlight=unique#torch.unique)
```
python
torch
.
unique
(
input
,
sorted
,
return_inverse
,
return_counts
,
dim
=
None
)
```
### [paddle.unique](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/unique_cn.html#unique)
```
python
paddle
.
unique
(
x
,
return_index
=
False
,
return_inverse
=
False
,
return_counts
=
False
,
axis
=
None
,
dtype
=
'int64'
,
name
=
None
)
```
### 参数差异
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
| input | x | 表示输入Tensor。 |
| sorted | - | 表示升序或者降序,PaddlePaddle无此参数。 |
| - | return_index | 表示是否返回独有元素在输入Tensor中的索引,PyTorch无此参数。 |
| return_inverse | return_inverse | 表示是否返回输入Tensor的元素对应在独有元素中的索引。 |
| return_counts | return_counts | 表示是否返回每个独有元素在输入Tensor中的个数。 |
| dim | axis | 表示指定选取独有元素的轴。 |
| dtype | - | 表示返回值的类型,PyTorch无此参数。 |
### 功能差异
#### 返回值差异
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
| output | out | 表示独有元素构成的Tensor。 |
| inverse_indices | inverse | (可选)表示输入Tensor的元素对应在独有元素中的索引。 |
| counts | counts | (可选)表示每个独有元素在输入Tensor中的个数。 |
| - | index | (可选)表示独有元素在输入Tensor中的索引,PyTorch无此返回值。 |
***PyTorch**
*
:(1)可以通过
`sorted`
设置是返回升序还是降序结果;(2)
`inverse_indices`
形状与原形状相同。
***PaddlePaddle**
*
:(1)只能返回升序结果;(2)
`inverse`
为
`inverse_indices`
展平后形状。
### 代码示例
```
python
# PyTorch示例:
import
torch
import
torch
x
=
torch
.
tensor
([[[
1
,
3
],
[
2
,
3
]],
[[
1
,
6
],
[
2
,
3
]]],
dtype
=
torch
.
float32
)
output
,
inverse_indices
,
counts
=
torch
.
unique
(
x
,
sorted
=
True
,
return_inverse
=
True
,
return_counts
=
True
)
# 输出
# output:
# tensor([1., 2., 3., 6.])
# inverse_indices:
# tensor([[[0, 2],
# [1, 2]],
# [[0, 3],
# [1, 2]]])
# counts:
# tensor([2, 2, 3, 1])
```
```
python
# PaddlePaddle示例:
import
paddle
x
=
paddle
.
to_tensor
([[[
1
,
3
],
[
2
,
3
]],
[[
1
,
6
],
[
2
,
3
]]],
dtype
=
"float32"
)
out
,
inverse
,
counts
=
paddle
.
unique
(
x
,
return_inverse
=
True
,
return_counts
=
True
)
# 输出
# out:
# Tensor(shape=[4], dtype=float32, place=CUDAPlace(0), stop_gradient=True,
# [1., 2., 3., 6.])
# inverse:
# Tensor(shape=[8], dtype=int64, place=CUDAPlace(0), stop_gradient=True,
# [0, 2, 1, 2, 0, 3, 1, 2])
# counts:
# Tensor(shape=[4], dtype=int64, place=CUDAPlace(0), stop_gradient=True,
# [2, 2, 3, 1])
```
docs/pytorch_project_convertor/API_docs/ops/torch.var_mean.md
0 → 100644
浏览文件 @
2e848d63
## torch.var_mean
### [torch.var_mean](https://pytorch.org/docs/stable/generated/torch.var_mean.html?highlight=var_mean#torch.var_mean)
```
python
# 用法一:
torch
.
var_mean
(
input
,
unbiased
=
True
)
# 用法二:
torch
.
var_mean
(
input
,
dim
,
keepdim
=
False
,
unbiased
=
True
)
```
### 功能介绍
用于实现返回Tensor的方差和均值,PaddlePaddle目前无对应API,可使用如下代码组合实现该API。
```
python
import
paddle
def
var_mean
(
input
,
dim
=
None
,
unbiased
=
True
,
keepdim
=
False
):
var
=
paddle
.
var
(
input
,
axis
=
dim
,
unbiased
=
unbiased
,
keepdim
=
keepdim
)
mean
=
paddle
.
mean
(
input
,
axis
=
dim
,
keepdim
=
keepdim
)
return
var
,
mean
```
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录