-
Notifications
You must be signed in to change notification settings - Fork 7.2k
Fixes types annotation #3059
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
Fixes types annotation #3059
Conversation
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.
Thanks a lot!
import torch.nn as nn | ||
from torch import Tensor | ||
from torch.jit.annotations import Dict, List, Tuple | ||
from torch.jit.annotations import Dict, List, Tuple, Optional |
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.
nit: is this needed?
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.
It is used in here
# type: (List[Tensor], Optional[List[Dict[str, Tensor]]]) -> Tuple[Dict[str, Tensor], List[Dict[str, 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.
Ok. Let's keep this here then, as when we move the # type:
annotations to be inline the import will be necessary
* Correcting incorrect types * Add missing type statement * Fix type annotations in unittest * Fix TypeError * Fix TypeError * Fix type equality judgment * Fix recursive compile * Use string for class name annotation. Co-authored-by: zhiqiang <zhiqwang@outlook.com>
This is based on the work of @zhiqwang at #3057
Just made a few minor changes to avoid the postponed evaluation of annotations.