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.16/17/18 #142

Merged
merged 7 commits into from
Jul 5, 2023
Merged

转换规则 No.16/17/18 #142

merged 7 commits into from
Jul 5, 2023

Conversation

Li-fAngyU
Copy link
Contributor

@Li-fAngyU Li-fAngyU commented Jun 28, 2023

PR Docs

PaddlePaddle/docs#5955

PR APIs

paddle.cummin
paddle.vander
paddle.searchsorted

@paddle-bot
Copy link

paddle-bot bot commented Jun 28, 2023

Thanks for your contribution!

@paddle-bot paddle-bot bot added contributor External developers status: proposed labels Jun 28, 2023
@Li-fAngyU
Copy link
Contributor Author

@Vooolta ,CI已全通过,本地测试pytest成功,麻烦有空的时候审核一下,谢谢!

ROckDog22
ROckDog22 previously approved these changes Jun 29, 2023
class SearchsortedMatcher(BaseMatcher):
def generate_code(self, kwargs):

if "side" in kwargs and kwargs["side"] is not None:
Copy link
Collaborator

Choose a reason for hiding this comment

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

side应该不能传入None吧,只能是 'left' 和 'right'

Copy link
Contributor Author

Choose a reason for hiding this comment

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

是的,经测试这里的kwargs是用户给定的kwargs, 即当用户没有显示设置side参数时,'side' no in kwargs 是True的。

def test_case_1():
    pytorch_code = textwrap.dedent(
        """
        import torch
        x = torch.tensor([[ 1,  3,  5,  7,  9],
                          [ 2,  4,  6,  8, 10]])
        values = torch.tensor([[3, 6, 9],
                               [3, 6, 9]])
        result = torch.searchsorted(x, values)
        """
    )
    obj.run(pytorch_code, ["result"])

如这里的测试案例1,kwargs = {'sorted_sequence':x, 'values':values}

我不太清楚我这样的理解正不正确?但是在去除kwargs['side']的判断之后,test_case_1会报KeyError: 'side'的错误。

Copy link
Contributor

Choose a reason for hiding this comment

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

这里应该不用判断None,只需判断if "side" in kwargs就行了

Copy link
Contributor Author

Choose a reason for hiding this comment

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

好的

class SearchsortedMatcher(BaseMatcher):
def generate_code(self, kwargs):

if "side" in kwargs and kwargs["side"] is not None:
Copy link
Contributor

Choose a reason for hiding this comment

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

这里应该不用判断None,只需判断if "side" in kwargs就行了

paconvert/api_matcher.py Outdated Show resolved Hide resolved
@Li-fAngyU
Copy link
Contributor Author

Done

@Li-fAngyU Li-fAngyU requested a review from ROckDog22 July 4, 2023 01:37
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

@zhwesky2010 zhwesky2010 merged commit 748524a into PaddlePaddle:master Jul 5, 2023
8 checks passed
@Li-fAngyU Li-fAngyU deleted the api_map_16_19 branch July 6, 2023 02:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor External developers HappyOpenSource 快乐开源活动issue与PR status: proposed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants