KEMBAR78
allow numpy-like boolean-list indexing in pytorch by ruochunz · Pull Request #14932 · pytorch/pytorch · GitHub
Skip to content

Conversation

@ruochunz
Copy link
Contributor

@ruochunz ruochunz commented Dec 8, 2018

Suggested fix to issue #6773, the fix allows numpy-like boolean-list indexing in pytorch

@soumith soumith changed the title Suggested fix to issue #6773 allow numpy-like boolean-list indexing in pytorch Dec 9, 2018
@soumith
Copy link
Member

soumith commented Dec 9, 2018

@ruochunz could you please add a unit test for this case, so that we dont miss it in any future refactors

@ruochunz
Copy link
Contributor Author

ruochunz commented Dec 9, 2018

Hi @soumith , something like this?

@fmassa
Copy link
Member

fmassa commented Dec 10, 2018

Hi,

I think this is fine, but I have a question: we are modifying the behavior of legacy_new_from_data to do something which is by itself quite unexpected I'd say (why are boolean types special in legacy_new_from_data?).
This function doesn't seem to be used anywhere else in the code, is that right?
Do we want to just modify the name of the function to make it explicit that it is specific to indexing, and thus bias the output type to be bool / int64?

@ruochunz
Copy link
Contributor Author

ruochunz commented Dec 10, 2018

Yes, I agree. legacy_new_from_data is not used anywhere else, so it would make sense for it to be renamed to make it explicit that it is specific to indexing.

Copy link
Member

@colesbury colesbury left a comment

Choose a reason for hiding this comment

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

Thanks for fixing this!

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.

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

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.

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

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.

7 participants