Skip to content
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

[dynamo] support dict.copy() / OrderedDict.copy() / defaultdict.copy() #115012

Closed
wants to merge 7 commits into from

Conversation

Copy link

pytorch-bot bot commented Dec 2, 2023

🔗 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 Failures

As of commit 78a97a8 with merge base ec124b9 (image):
💚 Looks good so far! There are no failures yet. 💚

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]
XuehaiPan added a commit to XuehaiPan/pytorch that referenced this pull request Dec 2, 2023
…copy()`

ghstack-source-id: 05dd93f4bddd6c26dd3180253769ee171597a800
Pull Request resolved: pytorch#115012
@Skylion007
Copy link
Collaborator

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]
XuehaiPan added a commit to XuehaiPan/pytorch that referenced this pull request Dec 3, 2023
…copy()`

ghstack-source-id: 793d09e4e2e6ec10ad65a035565d8698c2b43761
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]
Comment on lines +811 to +823
@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
Copy link
Collaborator Author

@XuehaiPan XuehaiPan Dec 3, 2023

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)

XuehaiPan added a commit to XuehaiPan/pytorch that referenced this pull request Dec 3, 2023
…copy()`

ghstack-source-id: cdadc70ba9297179f934b51786b0f35c05134181
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]
XuehaiPan added a commit to XuehaiPan/pytorch that referenced this pull request Dec 3, 2023
…copy()`

ghstack-source-id: 2946be5f996d3f766449fa0b4c10a341c0ba3994
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]
XuehaiPan added a commit to XuehaiPan/pytorch that referenced this pull request Dec 3, 2023
…copy()`

ghstack-source-id: de0201887125656a8888193a9708279b9d117965
Pull Request resolved: pytorch#115012
@XuehaiPan XuehaiPan added the ciflow/trunk Trigger trunk jobs on your pull request label Dec 3, 2023
XuehaiPan added a commit to XuehaiPan/pytorch that referenced this pull request Dec 3, 2023
…copy()`

ghstack-source-id: de0201887125656a8888193a9708279b9d117965
Pull Request resolved: pytorch#115012
@jansel
Copy link
Contributor

jansel commented Dec 4, 2023

@pytorchbot merge

@pytorchmergebot
Copy link
Collaborator

Merge failed

Reason: This PR needs a release notes: label
If your changes are user facing and intended to be a part of release notes, please use a label starting with release notes:.

If not, please add the topic: not user facing label.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "topic: not user facing"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

Details for Dev Infra team Raised by workflow job

@jansel
Copy link
Contributor

jansel commented Dec 4, 2023

@pytorchbot merge

@pytorchmergebot
Copy link
Collaborator

Merge started

Your 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

Advanced Debugging
Check the merge workflow status
here

@facebook-github-bot facebook-github-bot deleted the gh/XuehaiPan/20/head branch December 7, 2023 15:27
hyperfraise pushed a commit to hyperfraise/pytorch that referenced this pull request Dec 21, 2023
hyperfraise pushed a commit to hyperfraise/pytorch that referenced this pull request Dec 21, 2023
ZhiweiYan-96 pushed a commit to ZhiweiYan-96/pytorch that referenced this pull request Dec 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants