-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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][A-83] Add type annotations for paddle/vision/transforms/functional.py
#65560
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
def erase( | ||
img: _ImageDataLayout, | ||
i: int, | ||
j: int, | ||
h: int, | ||
w: int, | ||
v: int, | ||
inplace: bool = False, | ||
) -> _ImageDataLayout: |
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.
这里的 img 和输出不对吧?貌似应该是 img (paddle.Tensor | np.array | PIL.Image)
~ 可以考虑用 TypeVar ~
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.
这里补全没注意选错了,其他的应该没问题吧
_ImageDataType: TypeAlias = Union[Tensor, PILImage, npt.NDArray[Any]]
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.
这里(包括其他几个函数)为啥不用 TypeVar? TypeAlias
不能保证输入输出的类型一致吧 ~
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
Add type annotations for
paddle/vision/transforms/functional.py