-
Notifications
You must be signed in to change notification settings - Fork 26.3k
Сhange type of a tensor with bools #19097
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
|
@gchanan, i think this shows the JIT issue that you were mentioning yesterday. the failing test(test_jit.py::test_torch_tensor) shows that JIT.CompilationUnit is behaving differently. Should i update JITs logic or is it a BC issue and i should add a deprecation warning instead? |
| if (PyBool_Check(obj)) { | ||
| // TODO: infer Bool when we have Bool ScalarType | ||
| return ScalarType::Byte; | ||
| return ScalarType::Bool; |
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.
all of the non-test changes besides this look correct and can go in (because they don't break backcompat), right?
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.
this and jit changes
|
you should figure out where the JIT logic is first. |
5d36304 to
4947864
Compare
4947864 to
59824ea
Compare
facebook-github-bot
left a comment
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.
@izdeby has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
Summary: **This is **bc-breaking** change** Change dtype of a tensor which was created from bool data. Old behavior: torch.tensor([True, False]) -> uint8 tensor Now: torch.tensor([True, False]) -> bool tensor Tested via tests. Pull Request resolved: pytorch/pytorch#19097 Reviewed By: ezyang Differential Revision: D15632553 Pulled By: izdeby fbshipit-source-id: b019150844c561a6845710a3c62b12f06b68bbe3
This is bc-breaking change
Change dtype of a tensor which was created from bool data.
Old behavior: torch.tensor([True, False]) -> uint8 tensor
Now: torch.tensor([True, False]) -> bool tensor
Tested via tests.