-
Notifications
You must be signed in to change notification settings - Fork 26.3k
[JIT] Allow empty temporary list literals to be matched to arbitrary types #74768
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
Conversation
[ghstack-poisoned]
🔗 Helpful links
💊 CI failures summary and remediationsAs of commit 9691cf7 (more details on the Dr. CI page):
🕵️ 1 new failure recognized by patternsThe following CI failures do not appear to be due to upstream breakages
|
…rary types" [ghstack-poisoned]
… arbitrary types"
As commented in code:
```
// Empty List Literals that are not assigned to variables
// may match to any list type in schema matching,
// but still default to List[Tensor] if assigned to a variable
// or returned from a function
// Restricting empty list matching to temporary values
// avoids difficult to handle cases such as
// a = []
// b = a
// if cond:
// b.append(2)
// else:
// a.append("hi")
// This is also the same behavior that C++ allows with {}
// (cannot assign to a variable typed as auto)
```
Fix for pytorch/torchdynamo#95
[ghstack-poisoned]
… arbitrary types"
As commented in code:
```
// Empty List Literals that are not assigned to variables
// may match to any list type in schema matching,
// but still default to List[Tensor] if assigned to a variable
// or returned from a function
// Restricting empty list matching to temporary values
// avoids difficult to handle cases such as
// a = []
// b = a
// if cond:
// b.append(2)
// else:
// a.append("hi")
// This is also the same behavior that C++ allows with {}
// (cannot assign to a variable typed as auto)
```
Fix for pytorch/torchdynamo#95
[ghstack-poisoned]
… arbitrary types"
As commented in code:
```
// Empty List Literals that are not assigned to variables
// may match to any list type in schema matching,
// but still default to List[Tensor] if assigned to a variable
// or returned from a function
// Restricting empty list matching to temporary values
// avoids difficult to handle cases such as
// a = []
// b = a
// if cond:
// b.append(2)
// else:
// a.append("hi")
// This is also the same behavior that C++ allows with {}
// (cannot assign to a variable typed as auto)
```
Fix for pytorch/torchdynamo#95
[ghstack-poisoned]
Chillee
left a comment
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.
Looks good! I'll approve it but might be better for somebody else familiar with Torchscript to take a look.
… arbitrary types"
As commented in code:
```
// Empty List Literals that are not assigned to variables
// may match to any list type in schema matching,
// but still default to List[Tensor] if assigned to a variable
// or returned from a function
// Restricting empty list matching to temporary values
// avoids difficult to handle cases such as
// a = []
// b = a
// if cond:
// b.append(2)
// else:
// a.append("hi")
// This is also the same behavior that C++ allows with {}
// (cannot assign to a variable typed as auto)
```
Fix for pytorch/torchdynamo#95
[ghstack-poisoned]
|
@eellison has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
… arbitrary types"
As commented in code:
```
// Empty List Literals that are not assigned to variables
// may match to any list type in schema matching,
// but still default to List[Tensor] if assigned to a variable
// or returned from a function
// Restricting empty list matching to temporary values
// avoids difficult to handle cases such as
// a = []
// b = a
// if cond:
// b.append(2)
// else:
// a.append("hi")
// This is also the same behavior that C++ allows with {}
// (cannot assign to a variable typed as auto)
```
Fix for pytorch/torchdynamo#95
Differential Revision: [D35362760](https://our.internmc.facebook.com/intern/diff/D35362760)
[ghstack-poisoned]
|
@eellison has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
…types (#74768) Summary: Pull Request resolved: #74768 As commented in code: ``` // Empty List Literals that are not assigned to variables // may match to any list type in schema matching, // but still default to List[Tensor] if assigned to a variable // or returned from a function // Restricting empty list matching to temporary values // avoids difficult to handle cases such as // a = [] // b = a // if cond: // b.append(2) // else: // a.append("hi") // This is also the same behavior that C++ allows with {} // (cannot assign to a variable typed as auto) ``` Fix for pytorch/torchdynamo#95 Test Plan: Imported from OSS Reviewed By: ejguan Differential Revision: D35362760 Pulled By: eellison fbshipit-source-id: da23e8889312001b60d64a1758da5c578b6fe5ea
Stack from ghstack:
As commented in code:
Fix for pytorch/torchdynamo#95
Differential Revision: D35362760