Merged
Conversation
Collaborator
Author
|
I will add a test case for this, later. |
JackCaoG
reviewed
Mar 13, 2024
Comment on lines
-2184
to
-2191
| // Float scalar literal in Python defaults to F64. But we want to produce | ||
| // F32 as this is the default Pytorch behavior. | ||
| if (xla_type == xla::PrimitiveType::F64) { | ||
| xla_type = xla::PrimitiveType::F32; | ||
| } |
Collaborator
There was a problem hiding this comment.
I think @qihqi added this downcasting rule and you removed it in this pr.
Collaborator
Author
There was a problem hiding this comment.
I don't think we need this anymore, since at::result_type resolves to the appropriate type, as we can observe with the tests.
JackCaoG
reviewed
Mar 13, 2024
Collaborator
JackCaoG
left a comment
There was a problem hiding this comment.
can you add a test to test/test_operation.py for the result type?
Collaborator
|
not sure why CI is not running... |
Collaborator
Author
|
Maybe due to merge conflicts? I will try rebasing. |
5c9d1df to
aba3534
Compare
JackCaoG
approved these changes
Mar 18, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix: #6521
This PR fixes how PyTorch/XLA promotes types for
powfunction. It does so by resolving the resulting type of the operation by callingat::result_type(similar to howaddis implemented in PyTorch/XLA). This aligns the implementation with PyTorch's. See the example below:cc @miladm @JackCaoG