Skip to content

Conversation

@rgommers
Copy link
Collaborator

Closes gh-42968

@rgommers rgommers added the module: typing Related to mypy type annotations label Aug 22, 2020
@rgommers rgommers requested a review from apaszke as a code owner August 22, 2020 01:55
@dr-ci
Copy link

dr-ci bot commented Aug 22, 2020

💊 CI failures summary and remediations

As of commit 681be55 (more details on the Dr. CI page):


None of the CI failures appear to be your fault 💚



🚧 1 fixed upstream failure:

These were probably caused by upstream breakages that were already fixed.

Please rebase on the viable/strict branch (expand for instructions)

Since your merge base is older than viable/strict, run these commands:

git fetch https://github.com/pytorch/pytorch viable/strict
git rebase FETCH_HEAD

Check out the recency history of this "viable master" tracking branch.


This comment was automatically generated by Dr. CI (expand for details).Follow this link to opt-out of these comments for your Pull Requests.

Please report bugs/suggestions on the GitHub issue tracker or post in the (internal) Dr. CI Users group.

See how this bot performed.

This comment has been revised 24 times.

Copy link
Contributor

Choose a reason for hiding this comment

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

👍

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

@malfet has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@rgommers
Copy link
Collaborator Author

Hmm, still some inscrutable JIT errors that need fixing. Part of the issue is that get_type_line() in torch/jit/annotations.py seems to get confused by # type: ignore comments. I'll see if I can improve that.

@rgommers
Copy link
Collaborator Author

rgommers commented Aug 22, 2020

Okay, isolated the issue and a proposed way of fixing it in gh-43454. This PR is blocked until that's resolved.

facebook-github-bot pushed a commit that referenced this pull request Aug 25, 2020
Summary:
- `torch._VF` is a hack to work around the lack of support for `torch.functional` in the JIT
- that hack hides `torch._VF` functions from Mypy
- could be worked around by re-introducing a stub file for `torch.functional`, but that's undesirable
- so instead try to make both happy at the same time: the type ignore comments are needed for Mypy, and don't seem to affect the JIT after excluding them from the `get_type_line()` logic

Encountered this issue while trying to make `mypy` run on `torch/functional.py` in gh-43446.

Pull Request resolved: #43454

Reviewed By: glaringlee

Differential Revision: D23305579

Pulled By: malfet

fbshipit-source-id: 50e490693c1e53054927b57fd9acc7dca57e88ca
@rgommers
Copy link
Collaborator Author

rgommers commented Aug 25, 2020

Hmm, there's one CI failure (in caffe2_onnx_ort2_py3_6_clang7_ubuntu16_04_test) that seems to be caused by this PR:

self = <test_operators.TestOperators testMethod=test_meshgrid>

    def test_meshgrid(self):
        x = torch.ones(3, requires_grad=True)
        y = torch.zeros(4, requires_grad=True)
        z = torch.ones(5, requires_grad=True)
>       self.assertONNX(lambda x, y, z: torch.meshgrid(x, y, z), (x, y, z))

test/onnx/test_operators.py:849: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
test/onnx/test_operators.py:66: in assertONNX
    self.assertExpected(onnx_model_pbtxt, subname)
../.local/lib/python3.6/site-packages/torch/testing/_internal/common_utils.py:1305: in assertExpected
    self.assertMultiLineEqual(expected, s)
E   AssertionError: 'ir_v[355 chars]ut: "x"\n    input: "3"\n    output: "4"\n    [4894 chars]n}\n' != 'ir_v[355 chars]ut: "0"\n    input: "3"\n    output: "4"\n    [4894 chars]n}\n'
E   Diff is 5863 characters long. Set self.maxDiff to None to see it.

Likely a matter of updating the expected result, I'll look into it.

EDIT: yes, I can reproduce locally. The tweak to call a _meshgrid seems to cause input name changes like:

    node {
-     input: "x"
?             ^
+     input: "0"
?             ^

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

@malfet has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@rgommers
Copy link
Collaborator Author

This looks good to go now, the one CI failure is unrelated.

@facebook-github-bot
Copy link
Contributor

@malfet merged this pull request in 573940f.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Merged module: typing Related to mypy type annotations open source

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enable torch.functional typechecks during CI

5 participants