pytorch
e50dd5ba - [JIT] Allow empty temporary list literals to be matched to arbitrary types (#74768)

Commit
2 years ago
[JIT] Allow empty temporary list literals to be matched to arbitrary types (#74768) Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/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 https://github.com/facebookresearch/torchdynamo/issues/95 Test Plan: Imported from OSS Reviewed By: ejguan Differential Revision: D35362760 Pulled By: eellison fbshipit-source-id: da23e8889312001b60d64a1758da5c578b6fe5ea (cherry picked from commit 75682f17204d6d444e7e7144472c6e833150c601)
Author
Elias Ellison
Committer
Parents
Loading