未验证 提交 1d5bde56 编写于 作者: S SunAhong1993 提交者: GitHub

Add docs (#625)

* Update stargan.md

* fix the paddle_type

* add docs

* add docs

* add acknowledge

* fix the docs

* fix the docs

* add docs

* fix

* add docs

* add docs

* Update README.md
上级 e8620638
......@@ -145,6 +145,16 @@
| 140 | [torch.addmv](https://pytorch.org/docs/stable/generated/torch.addmv.html?highlight=addmv#torch.addmv) | 无对应实现 | [组合实现](https://github.com/PaddlePaddle/X2Paddle/tree/develop/docs/pytorch_project_convertor/API_docs/ops/torch.addmv.md) |
| 141 | [torch.addr](https://pytorch.org/docs/stable/generated/torch.addr.html?highlight=addr#torch.addr) | 无对应实现 | [组合实现](https://github.com/PaddlePaddle/X2Paddle/tree/develop/docs/pytorch_project_convertor/API_docs/ops/torch.addr.md) |
| 142 | [torch.baddbmm](https://pytorch.org/docs/stable/generated/torch.baddbmm.html?highlight=baddbmm#torch.baddbmm) | 无对应实现 | [组合实现](https://github.com/PaddlePaddle/X2Paddle/tree/develop/docs/pytorch_project_convertor/API_docs/ops/torch.baddbmm.md) |
| 143 | [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 |
| 143 | [torch.addmm](https://pytorch.org/docs/stable/generated/torch.addmm.html?highlight=addmm#torch.addmm) | [paddle.addmm](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/addmm_cn.html) | 功能一致,参数名不一致,PaddlePaddle未定义`out`参数代表输出Tensor |
| 144 | [torch.chain_matmul](https://pytorch.org/docs/stable/generated/torch.chain_matmul.html?highlight=chain_matmul#torch.chain_matmul) | 无对应实现 | [组合实现](https://github.com/PaddlePaddle/X2Paddle/tree/develop/docs/pytorch_project_convertor/API_docs/ops/torch.chain_matmul.md) |
| 145 | [torch.cholesky_inverse](https://pytorch.org/docs/stable/generated/torch.cholesky_inverse.html?highlight=cholesky_inverse#torch.cholesky_inverse) | 无对应实现 | [组合实现](https://github.com/PaddlePaddle/X2Paddle/tree/develop/docs/pytorch_project_convertor/API_docs/ops/torch.cholesky_inverse.md) |
| 146 | [torch.cholesky_solve](https://pytorch.org/docs/stable/generated/torch.cholesky_solve.html?highlight=cholesky_solve#torch.cholesky_solve) | 无对应实现 | [组合实现](https://github.com/PaddlePaddle/X2Paddle/tree/develop/docs/pytorch_project_convertor/API_docs/ops/torch.cholesky_solve.md) |
| 147 | [torch.matmul](https://pytorch.org/docs/stable/generated/torch.matmul.html?highlight=matmul#torch.matmul) | [paddle.matmul](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/matmul_cn.html) | [差异对比](https://github.com/PaddlePaddle/X2Paddle/tree/develop/docs/pytorch_project_convertor/API_docs/ops/torch.matmul.md) |
| 148 | [torch.mm](https://pytorch.org/docs/stable/generated/torch.mm.html?highlight=mm#torch.mm) | [paddle.matmul](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/matmul_cn.html) | [差异对比](https://github.com/PaddlePaddle/X2Paddle/tree/develop/docs/pytorch_project_convertor/API_docs/ops/torch.mm.md) |
| 149 | [torch.mv](https://pytorch.org/docs/stable/generated/torch.mv.html?highlight=mv#torch.mv) | 无对应实现 | [组合实现](https://github.com/PaddlePaddle/X2Paddle/tree/develop/docs/pytorch_project_convertor/API_docs/ops/torch.mv.md) |
***持续更新...***
## torch.chain_matmul
### [torch.chain_matmul](https://pytorch.org/docs/stable/generated/torch.chain_matmul.html?highlight=chain_matmul#torch.chain_matmul)
```python
torch.chain_matmul(*matrices, out=None)
```
### 功能介绍
用于实现多个矩阵相乘,PaddlePaddle目前无对应API,可使用如下代码组合实现该API。
```python
import paddle
def chain_matmul(*matrices, out=None):
assert len(matrices) >= 1, "Expected one or more matrices."
if len(matrices) == 1:
return matrices[0]
out = paddle.matmul(matrices[0], matrices[1])
for i in range(2, len(matrices)):
out = paddle.matmul(out, matrices[i])
return out
```
\ No newline at end of file
## torch.cholesky_inverse
### [torch.cholesky_inverse](https://pytorch.org/docs/stable/generated/torch.cholesky_inverse.html?highlight=cholesky_inverse#torch.cholesky_inverse)
```python
torch.cholesky_inverse(input, upper=False, out=None)
```
### 功能介绍
用于计算对称正定矩阵的逆矩阵,公式为:
> 当`upper`为False时,
> $inv=(uu^T)^{-1}$ ;
> 当`upper`为True时,
> $inv=(u^Tu)^{-1}$ 。
PaddlePaddle目前无对应API,可使用如下代码组合实现该API。
```python
import paddle
def cholesky_inverse(input, upper=False, out=None) :
u = paddle.cholesky(input, False)
ut = paddle.transpose(u, perm=[1, 0])
if upper:
out = paddle.inverse(paddle.matmul(ut, u))
else:
out = paddle.inverse(paddle.matmul(u, ut))
return out
```
\ No newline at end of file
## torch.cholesky_solve
### [torch.cholesky_solve](https://pytorch.org/docs/stable/generated/torch.cholesky_solve.html?highlight=cholesky_solve#torch.cholesky_solve)
```python
torch.cholesky_solve(input, input2, upper=False, out=None)
```
### 功能介绍
用于计算对称正定矩阵的逆矩阵,并与另一个矩阵相乘,公式为:
> 当`upper`为False时,
> $inv=(uu^T)^{-1}b$ ;
> 当`upper`为True时,
> $inv=(u^Tu)^{-1}b$ 。
PaddlePaddle目前无对应API,可使用如下代码组合实现该API。
```python
import paddle
def cholesky_solve(input, input2, upper=False, out=None) :
u = paddle.cholesky(input, False)
ut = paddle.transpose(u, perm=[1, 0])
if upper:
out = paddle.inverse(paddle.matmul(ut, u))
else:
out = paddle.inverse(paddle.matmul(u, ut))
out = paddle.matmul(out, input2)
return out
```
\ No newline at end of file
## torch.matmul
### [torch.matmul](https://pytorch.org/docs/stable/generated/torch.matmul.html?highlight=matmul#torch.matmul)
```python
torch.matmul(input, other, out=None)
```
### [paddle.matmul](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/matmul_cn.html)
```python
paddle.matmul(x, y, transpose_x=False, transpose_y=False, name=None)
```
### 参数差异
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
| input | x | 表示输入的第一个Tensor。 |
| other | y | 表示输入的第二个Tensor。 |
| - | transpose_x | 表示相乘前是否转置x,PyTorch无此参数。 |
| - | transpose_y | 表示相乘前是否转置y,PyTorch无此参数。 |
| out | - | 表示输出的Tensor,PaddlePaddle无此参数。 |
## torch.mm
### [torch.mm](https://pytorch.org/docs/stable/generated/torch.mm.html?highlight=mm#torch.mm)
```python
torch.mm(input, mat2, *, out=None)
```
### [paddle.matmul](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/matmul_cn.html)
```python
paddle.matmul(x, y, transpose_x=False, transpose_y=False, name=None)
```
### 参数差异
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
| input | x | 表示输入的第一个Tensor。 |
| other | y | 表示输入的第二个Tensor。 |
| - | transpose_x | 表示相乘前是否转置x,PyTorch无此参数。 |
| - | transpose_y | 表示相乘前是否转置y,PyTorch无此参数。 |
| out | - | 表示输出的Tensor,PaddlePaddle无此参数。 |
### 功能差异
#### 计算方式
***PyTorch***:只支持$n × m$的矩阵与$m × p$的矩阵相乘。
***PaddlePaddle***:支持的输入与`torch.matmul`相同。
\ No newline at end of file
## torch.mv
### [torch.mv](https://pytorch.org/docs/stable/generated/torch.mv.html?highlight=mv#torch.mv)
```python
torch.mv(input, vec, out=None)
```
### 功能介绍
用于实现矩阵(`input`,大小为$n × m$)与向量(`vec`, $m$)相乘,PaddlePaddle目前无对应API,可使用如下代码组合实现该API。
```python
import paddle
def mv(input, vec, out=None):
vec = paddle.unsqueeze(vec, 1)
out = paddle.matmul(input, vec)
out = paddle.squeeze(out, 1)
return out
```
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册