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

[Typing][B-23] Add type annotations for python/paddle/distribution/normal.py #65849

Merged
merged 4 commits into from
Jul 11, 2024

Conversation

enkilee
Copy link
Contributor

@enkilee enkilee commented Jul 9, 2024

PR Category

User Experience

PR Types

Improvements

Description

Copy link

paddle-bot bot commented Jul 9, 2024

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

Comment on lines 36 to 43
_NormalLoc: TypeAlias = Union[
float,
complex,
Sequence[float],
NestedSequence[float],
npt.NDArray[Union[np.float32, np.float64]],
Tensor,
]
Copy link
Contributor

Choose a reason for hiding this comment

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

可以把 float complex 单独作为一个 type,然后放到这里面,如:

_NormalLocBase: TypeAlias = Union[float, complex]
_NormalLoc: TypeAlias = Union[
    _NormalLocBase, 
    Sequence[_NormalLocBase],
    ...
    ]

相应的,npt 的应该也支持 complex ~

Copy link
Contributor Author

Choose a reason for hiding this comment

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

收到

@luotao1 luotao1 added the HappyOpenSource 快乐开源活动issue与PR label Jul 10, 2024
dtype: dtype

def __init__(
self, loc: _NormalLoc, scale: _NormalScale, name: str | None = None
Copy link
Member

Choose a reason for hiding this comment

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

#65822 和这个好像不一样?以哪个为准呢?

Copy link
Contributor

Choose a reason for hiding this comment

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

#65822 和这个好像不一样?以哪个为准呢?

? #65843 这个?

Copy link
Member

Choose a reason for hiding this comment

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

喔喔打开的 PR 太多贴错了 😂

Copy link
Contributor

Choose a reason for hiding this comment

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

@enkilee 帮忙确认一下?#65843 的文档里面我看是没写 complex,要不验证一下?🤟

Copy link
Contributor Author

@enkilee enkilee Jul 11, 2024

Choose a reason for hiding this comment

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

@megemini @SigureMo
test_distribution_normal单测本期黑客松加了complex支持。
test_distribution_lognormal拉了最新代码测试,也支持complex。

Comment on lines 42 to 43
Sequence[float],
NestedSequence[float],
Copy link
Contributor

@megemini megemini Jul 11, 2024

Choose a reason for hiding this comment

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

这里是否可以是

        Sequence[_NormalLocBase],
        NestedSequence[_NormalLocBase],

lognormal 那里呢?

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
Member

@SigureMo SigureMo left a comment

Choose a reason for hiding this comment

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

LGTMeow 🐾

@SigureMo SigureMo merged commit 46ae43f into PaddlePaddle:develop Jul 11, 2024
30 of 32 checks passed
lixcli pushed a commit to lixcli/Paddle that referenced this pull request Jul 22, 2024
@enkilee enkilee deleted the typing-b23 branch January 8, 2025 08:05
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants