-
Notifications
You must be signed in to change notification settings - Fork 25.7k
[dynamo] support dict.copy() / OrderedDict.copy() / defaultdict.copy()
#115012
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
…copy()` [ghstack-poisoned]
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/115012
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 78a97a8 with merge base ec124b9 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
…efaultdict.copy()`" cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx chenyang78 aakhundov kadeng [ghstack-poisoned]
…efaultdict.copy()`" cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx chenyang78 aakhundov kadeng [ghstack-poisoned]
|
Adding unit tests to all these PRs would be nice. You also solved some graph breaks in the current benchmarks to the CSV needs to be updated now. |
…efaultdict.copy()`" cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx chenyang78 aakhundov kadeng [ghstack-poisoned]
…copy()` ghstack-source-id: 793d09e Pull Request resolved: pytorch#115012
…efaultdict.copy()`" cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx chenyang78 aakhundov kadeng [ghstack-poisoned]
| @make_test | ||
| def test_dict_copy(x): | ||
| my_list = [("a", x), ("b", x + 1), ("c", x + 2)] | ||
| d1 = dict(my_list) | ||
| d1["a"] = x + 10 | ||
| d2 = d1.copy() | ||
| d2["a"] = x - 5 | ||
| d2["b"] = x + 3 | ||
| d3 = collections.OrderedDict(my_list) | ||
| d3["c"] = x + 20 | ||
| d4 = d3.copy() | ||
| d4["c"] = x - 10 | ||
| return d1["a"] * d2["a"] + d2["b"] + d3["c"] * d4["c"] + 1 |
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.
The test for defaultdict.copy is not added. Because the collections module is ignored in SKIP_DIRS. Also seems that the implementation for DefaultDictVariable is incomplete. Currently, we only support creating an empty defaultdict with the default_factory.
dd = defaultdict(int)We do not support passing a mapping / seq2 as the second argument. We also do not support keywords:
dd1 = defaultdict(int, {'a': 1, 'b': 2})
dd2 = defaultdict(int, zip('ab', range(2)))
dd3 = defaultdict(int, a=1, b=2)
dd4 = defaultdict(int, {'a': 1, 'b': 2}, c=3, d=4)…efaultdict.copy()`" cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx chenyang78 aakhundov kadeng [ghstack-poisoned]
…efaultdict.copy()`" cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx chenyang78 aakhundov kadeng [ghstack-poisoned]
…copy()` ghstack-source-id: de02018 Pull Request resolved: pytorch#115012
|
@pytorchbot merge |
Merge failedReason: This PR needs a If not, please add the To add a label, you can comment to pytorchbot, for example For more information, see Details for Dev Infra teamRaised by workflow job |
|
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
…copy()` (pytorch#115012) Pull Request resolved: pytorch#115012 Approved by: https://github.com/jansel ghstack dependencies: pytorch#115010, pytorch#115011
Stack from ghstack (oldest at bottom):
dictin sorted key ordering #114947dict.copy()/OrderedDict.copy()/defaultdict.copy()#115012dict.update(seq2)/OrderedDict.update(seq2)/defaultdict.update(seq2)#115011dict.fromkeys()/OrderedDict.fromkeys()/defaultdict.fromkeys()#115010cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @chenyang78 @aakhundov @kadeng