-
Notifications
You must be signed in to change notification settings - Fork 5.8k
[Typing][B-21] Add type annotations for python/paddle/distribution/multinomial.py
#65844
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
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
@@ -66,7 +71,7 @@ class Multinomial(distribution.Distribution): | |||
[3., 3., 4.]]]) | |||
""" | |||
|
|||
def __init__(self, total_count, probs): | |||
def __init__(self, total_count: int, probs: Tensor) -> 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.
类属性 total_count probs
@@ -142,7 +147,7 @@ def log_prob(self, value): | |||
+ (value * logits).sum(-1) | |||
) | |||
|
|||
def sample(self, shape=()): | |||
def sample(self, shape: tuple[int]) -> 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.
def sample(self, shape: tuple[int]) -> Tensor: | |
def sample(self, shape: Iterable[int]) -> Tensor: |
用 Iterable
吧,下面代码用的这个做判断 ~
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
B21