-
Notifications
You must be signed in to change notification settings - Fork 765
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. 49 #5849
映射文档 No. 49 #5849
Changes from all commits
9c1a003
34f270f
5a0de26
0a190de
d30dd16
0af4ed7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
## [ torch 参数更多 ] torch.qr | ||
|
||
### [torch.qr](https://pytorch.org/docs/1.13/generated/torch.qr.html#torch.qr) | ||
|
||
```python | ||
torch.qr(input, some=True, *, out=None) | ||
``` | ||
|
||
### [paddle.linalg.qr](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/linalg/qr_cn.html#qr) | ||
|
||
```python | ||
paddle.linalg.qr(x, mode='reduced', name=None) | ||
``` | ||
|
||
其中 PyTorch 相比 Paddle 支持更多其他参数,具体如下: | ||
|
||
### 参数映射 | ||
| PyTorch | PaddlePaddle | 备注 | | ||
| ------------- | ------------ | ------------------------------------------------------ | | ||
| input | x | 表示输入 Tensor,仅参数名不一致。 | | ||
| some | mode | 表示 QR 分解的行为。 需进行转写。 | | ||
| out | - | 表示输出的 Tensor 元组。 Paddle 无此参数,需要进行转写。 | | ||
|
||
### 转写示例 | ||
### some:控制 QR 分解的行为 | ||
```python | ||
# 当进行完整的 QR 分解时 | ||
# Pytorch 写法 | ||
q, r = torch.qr(x, some=False) | ||
|
||
# Paddle 写法 | ||
q, r = paddle.linalg.qr(x, mode='complete') | ||
|
||
#当进行减少的 QR 分解时 | ||
# Pytorch 写法 | ||
q, r = torch.qr(x, some=True) | ||
|
||
# Paddle 写法 | ||
q, r = paddle.linalg.qr(x, mode='reduced') | ||
``` | ||
|
||
#### out:指定输出 | ||
```python | ||
# Pytorch 写法 | ||
torch.qr(x, out = (q, r) ) | ||
|
||
# Paddle 写法 | ||
q, r = paddle.linalg.qr(x) | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
## [ torch 参数更多 ] torch.svd | ||
|
||
### [torch.svd](https://pytorch.org/docs/1.13/generated/torch.svd.html?highlight=torch+svd#torch.svd) | ||
|
||
```python | ||
torch.svd(input, some=True, compute_uv=True, *, out=None) | ||
``` | ||
|
||
### [paddle.linalg.svd](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/linalg/svd_cn.html#svd) | ||
|
||
```python | ||
paddle.linalg.svd(x, full_matrics=False, name=None) | ||
``` | ||
|
||
其中 PyTorch 相比 Paddle 支持更多其他参数,具体如下: | ||
|
||
### 参数映射 | ||
| PyTorch | PaddlePaddle | 备注 | | ||
| ------------- | ------------ | ------------------------------------------------------ | | ||
| input | x | 输入 Tensor ,仅参数名不一致。 | | ||
| some | full_matrics | 表示需计算的奇异值数目。 与 Pytorch 默认值不同,需要转写。 | | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 默认值看起来是一样的,但是功能是相反的 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. torch.svd中的some参数默认值为 |
||
| compute_uv | - | 表示是否计算 U 和 V 。 Paddle 暂无转写方式。 | | ||
| out | - | 表示输出的 Tensor 元组。 Paddle 无此参数,需要进行转写。 | | ||
|
||
### 转写示例 | ||
#### some:表示需计算的奇异值数目 | ||
```python | ||
# Pytorch 写法 | ||
u, s, v = torch.svd(x, some = True ) | ||
|
||
# Paddle 写法 | ||
u, s, v = paddle.linalg.svd(x, full_matrics = False) | ||
``` | ||
#### out:指定输出 | ||
```python | ||
# Pytorch 写法 | ||
torch.svd(x, out=(u, s, v) ) | ||
|
||
# Paddle 写法 | ||
u, s, v = paddle.linalg.svd(x) | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
## [ torch 参数更多 ] torch.svd_lowrank | ||
|
||
### [torch.svd_lowrank](https://pytorch.org/docs/1.13/generated/torch.svd_lowrank.html?highlight=torch+svd_lowrank#torch.svd_lowrank) | ||
|
||
```python | ||
torch.svd_lowrank(A, q=6, niter=2, M=None) | ||
``` | ||
|
||
### [paddle.linalg.svd](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/linalg/svd_cn.html#svd) | ||
|
||
```python | ||
paddle.linalg.svd(x, full_matrics=False, name=None) | ||
``` | ||
|
||
其中 PyTorch 相比 Paddle 支持更多其他参数,具体如下: | ||
|
||
### 参数映射 | ||
| PyTorch | PaddlePaddle | 备注 | | ||
| ------------- | ------------ | ------------------------------------------------------ | | ||
| A | x | 表示输入 Tensor,仅参数名不一致。 | | ||
| q | - | 表示输入 Tensor 略高估计秩。 Paddle 暂无转写方式。 | | ||
| niter | - | 表示子空间进行迭代的数量。 Paddle 暂无转写方式。 | | ||
| M | - | 表示输入 Tensor 的平均 size。 Paddle 暂无转写方式。 | | ||
| - | full_matrics | 表示是否计算完整的 U 和 V 矩阵。 PyTorch 无此参数,Paddle 保持默认即可。 | |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
## [ torch 参数更多 ] torch.symeig | ||
|
||
### [torch.symeig](https://pytorch.org/docs/1.13/generated/torch.symeig.html?highlight=torch+symeig#torch.symeig) | ||
|
||
```python | ||
torch.symeig(input, eigenvectors=False, upper=True, *, out=None) | ||
``` | ||
|
||
### [paddle.linalg.eigh](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/linalg/eigh_cn.html#eigh) | ||
|
||
```python | ||
paddle.linalg.eigh(x, UPLO='L', name=None) | ||
``` | ||
|
||
其中 PyTorch 相比 Paddle 支持更多其他参数,具体如下: | ||
|
||
### 参数映射 | ||
| PyTorch | PaddlePaddle | 备注 | | ||
| ------------- | ------------ | ------------------------------------------------------ | | ||
| input | x | 输入的对称 Tensor,仅参数名不一致。 | | ||
| eigenvectors | - | 表示是否计算特征向量。Paddle 暂无转写方式。 | | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 这个应该也没办法组合出来对吧 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. pytorch中的eigenvectors参数表示是同时计算特征向量和特征值还是只计算特征值,paddle.linalg.eigh函数中没有这个功能对应,无法组合转写。 |
||
| upper | UPLO | 表示计算上三角或者下三角矩阵。 需进行转写。 | | ||
| out | - | 表示输出的 Tensor 元组, Paddle 无此参数,需要进行转写。 | | ||
|
||
### 转写示例 | ||
#### upper:表示计算上三角或者下三角矩阵 | ||
```python | ||
# Pytorch 写法 | ||
e, v = torch.symeig(x, upper = False) | ||
|
||
# Paddle 写法 | ||
e, v = paddle.linalg.eigh(x, UPLO = 'L') | ||
``` | ||
|
||
#### out:指定输出 | ||
```python | ||
# Pytorch 写法 | ||
torch.symeig(x, out=(e, v) ) | ||
|
||
# Paddle 写法 | ||
e, v = paddle.linalg.eigh(x) | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some=True时怎么转写,也需要加上
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已添加