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. 87 #6051

Merged
merged 8 commits into from
Aug 21, 2023
Merged

映射文档 No. 87 #6051

merged 8 commits into from
Aug 21, 2023

Conversation

co63oc
Copy link
Contributor

@co63oc co63oc commented Jul 25, 2023

PaddlePaddle/PaConvert#112

87 torch.Tensor.lstsq torch 历史版本 1.9.0 支持 ,paddle无文档和关联代码行,paddle代码中对应paddle.linalg.lstsq

paddle.Tensor.lstsq(y, rcond=None, driver=None, name=None)
```

两者功能一致,仅参数名不一致,具体如下:
Copy link
Collaborator

Choose a reason for hiding this comment

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

这里的综述写得不太对:

paddle参数更多

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已修改

@@ -0,0 +1,23 @@
## [ 仅 paddle 参数更多 ]torch.linalg.lstsq
Copy link
Collaborator

Choose a reason for hiding this comment

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

这个和下面的签名对不上

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已修改

@@ -0,0 +1,23 @@
## [ 仅 paddle 参数更多 ]torch.linalg.lstsq

### [torch.Tensor.lstsq](https://pytorch.org/docs/1.9.0/generated/torch.Tensor.lstsq.html?highlight=torch%20tensor%20lstsq#torch.Tensor.lstsq)
Copy link
Collaborator

Choose a reason for hiding this comment

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

签名对不上

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已修改

Copy link
Collaborator

@zhwesky2010 zhwesky2010 left a comment

Choose a reason for hiding this comment

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

torch.linalg.lstsq与padde是对齐的
但torch.lstsq是顺序相反的,要分析下参数映射关系,不能直接对应

infoflow 2023-08-03 12-45-40

### [paddle.Tensor.lstsq]()

```python
paddle.Tensor.lstsq(y, rcond=None, driver=None, name=None)
Copy link
Collaborator

Choose a reason for hiding this comment

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

这里是不是有些差异,可以运行下代码看下,torch.lstsq 的A在第二个位置,B在第一个位置,paddle的lstsq是相反的

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已修改,参数是相反,转换规则 PR PaddlePaddle/PaConvert#219


| PyTorch | PaddlePaddle | 备注 |
| ------- | ------------ | --------------------------------------------------------------------------- |
| A | y | 表示输入的 Tensor ,PyTorch 和 Paddle 参数相反,需要转写。 |
Copy link
Collaborator

Choose a reason for hiding this comment

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

这个写法可以参考下其他的linalg api,比如triangular_solve、solve等api有没有这种 强调 调用关系相反的 话术

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已修改

| ------- | ------------ | --------------------------------------------------------------------------- |
| A | y | 表示输入的 Tensor ,PyTorch 和 Paddle 参数相反,需要转写。 |
| - | rcond | 用来决定 x 有效秩的 float 型浮点数。PyTorch 无此参数,Paddle 保持默认即可。 |
| - | driver | 用来指定计算使用的 LAPACK 库方法。PyTorch 无此参数,Paddle 保持默认即可。 |
Copy link
Collaborator

Choose a reason for hiding this comment

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

返回值是否有个数的差异,如果有就需要列出来 返回值 这一行
分类上就算 参数不一致

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已修改分类,增加返回值行

Copy link
Collaborator

@zhwesky2010 zhwesky2010 left a comment

Choose a reason for hiding this comment

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

LGTM,看来只有第一个返回值能对上,这两个API的差异挺大

@luotao1 luotao1 merged commit 6e2dbe7 into PaddlePaddle:develop Aug 21, 2023
1 check passed
@co63oc co63oc deleted the api87 branch August 30, 2023 23:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor HappyOpenSource 快乐开源活动issue与PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants