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

ONNX: fix bug in export of ops involving torch.bool type #40006

Closed
wants to merge 2 commits into from

Conversation

yaeldekel
Copy link
Contributor

When an op involves creating a tensor of a certain type (such as torch.ones(...)), the tracer creates a prim::Constant node with an integer value representing the type. The mapping from the torch type to integers maps:

torch.complex32 -> 8
torch.complex64 -> 9
torch.complex128 -> 10
torch.bool -> 11

However, when the ONNX exporter maps back the integer to torch type, 10 is mapped to bool, 9 is mapped to complex128 and 8 is mapped to complex64.

@dr-ci
Copy link

dr-ci bot commented Jun 14, 2020

💊 CI failures summary and remediations

As of commit 25b0cae (more details on the Dr. CI page):


💚 💚 Looks good so far! There are no failures yet. 💚 💚


This comment was automatically generated by Dr. CI (expand for details).Follow this link to opt-out of these comments for your Pull Requests.

Please report bugs/suggestions on the GitHub issue tracker or post in the (internal) Dr. CI Users group.

See how this bot performed.

This comment has been revised 11 times.

@take-cheeze
Copy link
Contributor

Seems to solve #32280

Copy link
Contributor

@neginraoof neginraoof left a comment

Choose a reason for hiding this comment

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

Looks good. Thanks!

@KsenijaS
Copy link
Contributor

looks good. LGTM!

@vadimkantorov
Copy link
Contributor

Currently torch.ones(2, 4, dtype=torch.bool).sum(dim = 1) failed for me (and .to(torch.int32) prior to sum(...) helped). Will this PR fix it as well?

Copy link
Member

@houseroad houseroad 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 the fix.

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.

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

@facebook-github-bot
Copy link
Contributor

@houseroad merged this pull request in 766889b.

@twangnh
Copy link

twangnh commented Aug 26, 2020

I'm wondering which version of pytorch should I install for having this fix ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants