-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
python/paddle/distribution/normal.py
Outdated
_NormalLoc: TypeAlias = Union[ | ||
float, | ||
complex, | ||
Sequence[float], | ||
NestedSequence[float], | ||
npt.NDArray[Union[np.float32, np.float64]], | ||
Tensor, | ||
] |
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.
可以把 float complex
单独作为一个 type,然后放到这里面,如:
_NormalLocBase: TypeAlias = Union[float, complex]
_NormalLoc: TypeAlias = Union[
_NormalLocBase,
Sequence[_NormalLocBase],
...
]
相应的,npt 的应该也支持 complex ~
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.
收到
dtype: dtype | ||
|
||
def __init__( | ||
self, loc: _NormalLoc, scale: _NormalScale, name: str | None = None |
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.
#65822 和这个好像不一样?以哪个为准呢?
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.
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.
喔喔打开的 PR 太多贴错了 😂
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.
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.
python/paddle/distribution/normal.py
Outdated
Sequence[float], | ||
NestedSequence[float], |
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.
这里是否可以是
Sequence[_NormalLocBase],
NestedSequence[_NormalLocBase],
lognormal 那里呢?
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.
抱歉,我疏忽了。
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.
PR Category
User Experience
PR Types
Improvements
Description
B23