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

【PaddlePaddle Hackathon 5th No.42】转换规则 第一组 #301

Closed
wants to merge 15 commits into from

Conversation

zrr1999
Copy link
Member

@zrr1999 zrr1999 commented Sep 25, 2023

PR Docs

https://github.com/PaddlePaddle/docs/pull/5751/files#diff-4edc87fd8fe3db15402459c161ba90be7f26cb3ffd4d25612e8bbc386442059d

PR APIs

torch.Tensor.tile
torch.Tensor.to_sparse
torch.Tensor.quantile
torch.nanquantile
torch.Tensor.stft
torch.stft

@paddle-bot
Copy link

paddle-bot bot commented Sep 25, 2023

Thanks for your contribution!

@paddle-bot paddle-bot bot added the contributor External developers label Sep 25, 2023
@zrr1999 zrr1999 marked this pull request as ready for review September 25, 2023 12:57
@zrr1999 zrr1999 changed the title 转换规则 torch.Tensor.tile, torch.Tensor.to_sparse 【PaddlePaddle Hackathon 5th】转换规则 torch.Tensor.tile, torch.Tensor.to_sparse Sep 25, 2023
@zrr1999 zrr1999 changed the title 【PaddlePaddle Hackathon 5th】转换规则 torch.Tensor.tile, torch.Tensor.to_sparse 【PaddlePaddle Hackathon 5th No. 42】转换规则 torch.Tensor.tile, torch.Tensor.to_sparse Sep 25, 2023
@zrr1999 zrr1999 changed the title 【PaddlePaddle Hackathon 5th No. 42】转换规则 torch.Tensor.tile, torch.Tensor.to_sparse 【PaddlePaddle Hackathon 5th No.42】转换规则 torch.Tensor.tile, torch.Tensor.to_sparse Sep 25, 2023
@zrr1999 zrr1999 changed the title 【PaddlePaddle Hackathon 5th No.42】转换规则 torch.Tensor.tile, torch.Tensor.to_sparse 【PaddlePaddle Hackathon 5th No.42】转换规则 torch.Tensor.tile, torch.Tensor.to_sparse, torch.Tensor.quantile Sep 25, 2023
@zrr1999 zrr1999 changed the title 【PaddlePaddle Hackathon 5th No.42】转换规则 torch.Tensor.tile, torch.Tensor.to_sparse, torch.Tensor.quantile 【PaddlePaddle Hackathon 5th No.42】转换规则 第一组 Sep 25, 2023
@zrr1999
Copy link
Member Author

zrr1999 commented Sep 26, 2023

@zhwesky2010 您好麻烦看一下stft,精度好像有些问题,差距有点大,但是我在本地是可以通过的,其他部分没有问题

@zhwesky2010
Copy link
Collaborator

@zhwesky2010 您好麻烦看一下stft,精度好像有些问题,差距有点大,但是我在本地是可以通过的,其他部分没有问题

CI上是CPU的版本,你本地用CPU试一下,另外每一组有约20个API,这一组其他的呢

paconvert/api_mapping.json Show resolved Hide resolved
if kwargs is None:
return None

if "reps" in kwargs:
Copy link
Collaborator

Choose a reason for hiding this comment

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

还有一个支持 可变参数的写法,例如:

reps=2, 3, 4
x.tile(*reps)

infoflow 2023-09-26 11-54-06

Copy link
Member Author

Choose a reason for hiding this comment

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

这里我目前测试,可变参数的写法应该是已经支持的,参考的TensorPermuteMatcher
image

Copy link
Collaborator

Choose a reason for hiding this comment

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

这里我目前测试,可变参数的写法应该是已经支持的,参考的TensorPermuteMatcher image

参考最新的TensorPermuteMatcher,已经重构到更好写法了。
另外本地测试不具有说明性,必须要在单测中添加相应测试,test_Tensor_tile目前的测试是很不全的

paconvert/api_matcher.py Outdated Show resolved Hide resolved
return code


class StftMatcher(BaseMatcher):
Copy link
Collaborator

Choose a reason for hiding this comment

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

这两个合并到一块吧,像这样加个判断:

infoflow 2023-09-26 11-57-44

Copy link
Member Author

Choose a reason for hiding this comment

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

已添加

pytorch_code = textwrap.dedent(
"""
import torch
result = torch.tensor([0., 1., 2., 3.],dtype=torch.float64).quantile(0.6, dim=None, keepdim=False)
Copy link
Collaborator

Choose a reason for hiding this comment

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

dim输入实际值

Copy link
Member Author

Choose a reason for hiding this comment

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

已添加

obj = APIBase("torch.Tensor.quantile")


def test_case_1():
Copy link
Collaborator

Choose a reason for hiding this comment

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

(0.13631296157836914+0j) ,
(-0.19927024841308594+0j) ,
(0.19927024841308594+0j) ]])
result = x.stft(n_fft=4, onesided=False, return_complex=True)
Copy link
Collaborator

Choose a reason for hiding this comment

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

同上

)


def test_case_2():
Copy link
Collaborator

Choose a reason for hiding this comment

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

同上,测试内容不全

参考test_Tensor_reshape的测试

def test_case_4():
pytorch_code = textwrap.dedent(
"""
import torch
Copy link
Collaborator

Choose a reason for hiding this comment

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

同上,测试内容补全,dim请输入实际值,不能刻意绕过问题

infoflow 2023-09-26 12-01-26

Copy link
Member Author

Choose a reason for hiding this comment

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

已修改添加

obj = APIBase("torch.stft")


def test_case_1():
Copy link
Collaborator

Choose a reason for hiding this comment

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

同上

@zrr1999
Copy link
Member Author

zrr1999 commented Sep 26, 2023

@zhwesky2010 您好麻烦看一下stft,精度好像有些问题,差距有点大,但是我在本地是可以通过的,其他部分没有问题

CI上是CPU的版本,你本地用CPU试一下,另外每一组有约20个API,这一组其他的呢

这一部分是由文档的部分,其他的需要我先去补充下文档合入后,再作为第二个pr提交

if kwargs is None:
return None

if "reps" in kwargs:
Copy link
Collaborator

Choose a reason for hiding this comment

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

这里我目前测试,可变参数的写法应该是已经支持的,参考的TensorPermuteMatcher image

参考最新的TensorPermuteMatcher,已经重构到更好写法了。
另外本地测试不具有说明性,必须要在单测中添加相应测试,test_Tensor_tile目前的测试是很不全的

@@ -30,6 +30,18 @@ def test_case_1():
obj.run(
pytorch_code,
["result"],
unsupport=True,
reason="Paddle not support this api convert now",
)
Copy link
Collaborator

Choose a reason for hiding this comment

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

参考最新的test_Tensor_permute测试,包含十几种用例

@zhwesky2010
Copy link
Collaborator

zhwesky2010 commented Oct 11, 2023

@zrr1999 PR未通过单测测试,另外已经有文档的需要全部检查一下,如果有问题也需要修正。

@luotao1
Copy link
Collaborator

luotao1 commented Nov 13, 2023

@zrr1999 转换规则第1组只剩下 torch.stft

@Li-fAngyU 这个PR里有 torch.stft 的处理,看看能否合作?

@luotao1 luotao1 closed this Nov 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor External developers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants