Skip to content

Conversation

datumbox
Copy link
Contributor

@datumbox datumbox commented Nov 30, 2020

This is based on the work of @zhiqwang at #3057

Just made a few minor changes to avoid the postponed evaluation of annotations.

Copy link
Member

@fmassa fmassa left a 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
Copy link
Member

Choose a reason for hiding this comment

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

nit: is this needed?

Copy link
Contributor

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]]]

Copy link
Member

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

@fmassa fmassa merged commit 181e81c into pytorch:master Nov 30, 2020
@datumbox datumbox deleted the zhiqwang/fix_type branch November 30, 2020 10:59
vfdev-5 pushed a commit to Quansight/vision that referenced this pull request Dec 4, 2020
* 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants