Skip to content

Allow structseq to be input of operators where tuple is expected#17208

Closed
zasdfgbnm wants to merge 21 commits intopytorch:masterfrom
zasdfgbnm:py2-structseq-as-tuple
Closed

Allow structseq to be input of operators where tuple is expected#17208
zasdfgbnm wants to merge 21 commits intopytorch:masterfrom
zasdfgbnm:py2-structseq-as-tuple

Conversation

@zasdfgbnm
Copy link
Collaborator

@zasdfgbnm zasdfgbnm commented Feb 16, 2019

Currently the following code gives an error on python 2 because ret is a structseq which is not a tuple

ret = a.max(dim=0)
ret1 = torch.max(a, dim=0, out=ret)

This PR modify tuple check in python arg parser to allow structseq to be input of operators where tuple is expected, which would make the above code work.

Depend on: #17136
Partially fixes: #16813

commit 00ab07d
Author: Xiang Gao <qasdfgtyuiop@gmail.com>
Date:   Sat Feb 16 15:52:27 2019 -0500

    more cleanup py2-py3 logic

commit b939afb
Author: Xiang Gao <qasdfgtyuiop@gmail.com>
Date:   Sat Feb 16 15:25:53 2019 -0500

    cleanup py2-py3 logic
commit a808b39
Author: Xiang Gao <qasdfgtyuiop@gmail.com>
Date:   Sat Feb 16 17:09:20 2019 -0500

    fix namespace

commit 00ab07d
Author: Xiang Gao <qasdfgtyuiop@gmail.com>
Date:   Sat Feb 16 15:52:27 2019 -0500

    more cleanup py2-py3 logic

commit b939afb
Author: Xiang Gao <qasdfgtyuiop@gmail.com>
Date:   Sat Feb 16 15:25:53 2019 -0500

    cleanup py2-py3 logic
@zasdfgbnm
Copy link
Collaborator Author

cc: @ezyang @apaszke

@ezyang
Copy link
Contributor

ezyang commented Feb 21, 2019

Manual refcounting makes me nervous. This will need a close code review.

@ezyang
Copy link
Contributor

ezyang commented Feb 21, 2019

cc @VitalyFedyunin

@zasdfgbnm
Copy link
Collaborator Author

@ezyang @apaszke @VitalyFedyunin Let's work on #17136 first :). This PR is built upon #17136 .

@VitalyFedyunin
Copy link
Contributor

VitalyFedyunin commented Feb 28, 2019

Merge most recent master into it please.

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@VitalyFedyunin has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@VitalyFedyunin
Copy link
Contributor

@pytorchbot retest this please

@zasdfgbnm
Copy link
Collaborator Author

@pytorchbot rebase this please

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@VitalyFedyunin is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@zasdfgbnm zasdfgbnm deleted the py2-structseq-as-tuple branch March 11, 2019 18:43
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.

Namedtuples and compatibility for python < 3.2

6 participants