-
Notifications
You must be signed in to change notification settings - Fork 25.6k
[jit] fix trace checking reporting divergent names #37464
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
Closed
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Fixes #23993. There are two fixes here: 1. Previously our name lookup function for the tracer was looking in f.globals for names. For example: ``` sample = torch.ones(1) traced = torch.jit.trace(my_mod, ((sample, sample,),)) ``` This is not great if you are, e.g. trace checking, because a non-local bit of interpreter state is affected the graph produced: ``` traced = torch.jit.trace(my_mod, _clone_inputs((sample, sample,),)) ``` I have removed this functionality, as I don't think it provides huge value. Things that look locally for names will still work, so e.g. inputs, intermediate variables, and the like will be named correctly. 2. Previously, our input cloning for trace checking didn't do a memoized deep copy. So: ``` _clone_inputs((sample, sample, sample)) ``` produces a tuple with three non-aliased tensors. That's wrong! Use copy.deepcopy with a memoization argument to fix this. [ghstack-poisoned]
Fixes #23993. There are two fixes here: 1. Previously our name lookup function for the tracer was looking in f.globals for names. For example: ``` sample = torch.ones(1) traced = torch.jit.trace(my_mod, ((sample, sample,),)) # produces a graph with something like # %sample, %sample = prim::TupleUnpack(%input) ``` This is not great if you are, e.g. trace checking, because a non-local bit of interpreter state is affected the graph produced: ``` traced = torch.jit.trace(my_mod, _clone_inputs((sample, sample,),)) # produces a graph with something like # %0, %1 = prim::TupleUnpack(%input) ``` I have removed this functionality, as I don't think it provides huge value. Things that look locally for names will still work, so e.g. inputs, intermediate variables, and the like will be named correctly. 2. Previously, our input cloning for trace checking didn't do a memoized deep copy. So: ``` _clone_inputs((sample, sample, sample)) ``` produces a tuple with three non-aliased tensors. That's wrong! Use copy.deepcopy with a memoization argument to fix this. [ghstack-poisoned]
suo
added a commit
that referenced
this pull request
Apr 28, 2020
Fixes #23993. There are two fixes here: 1. Previously our name lookup function for the tracer was looking in f.globals for names. For example: ``` sample = torch.ones(1) traced = torch.jit.trace(my_mod, ((sample, sample,),)) ``` This is not great if you are, e.g. trace checking, because a non-local bit of interpreter state is affected the graph produced: ``` traced = torch.jit.trace(my_mod, _clone_inputs((sample, sample,),)) ``` I have removed this functionality, as I don't think it provides huge value. Things that look locally for names will still work, so e.g. inputs, intermediate variables, and the like will be named correctly. 2. Previously, our input cloning for trace checking didn't do a memoized deep copy. So: ``` _clone_inputs((sample, sample, sample)) ``` produces a tuple with three non-aliased tensors. That's wrong! Use copy.deepcopy with a memoization argument to fix this. ghstack-source-id: 20428a0 Pull Request resolved: #37464
💊 Build failures summary and remediationsAs of commit 3b24b5b (more details on the Dr. CI page):
ci.pytorch.org: 1 failedThis 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. This comment has been revised 2 times. |
zdevito
approved these changes
Apr 29, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Stack from ghstack:
Fixes #23993.
There are two fixes here:
f.globals for names. For example:
This is not great if you are, e.g. trace checking, because a non-local
bit of interpreter state is affected the graph produced:
I have removed this functionality, as I don't think it provides huge
value. Things that look locally for names will still work, so e.g.
inputs, intermediate variables, and the like will be named correctly.
deep copy. So:
produces a tuple with three non-aliased tensors. That's wrong! Use
copy.deepcopy with a memoization argument to fix this.
Differential Revision: D21297549