-
Notifications
You must be signed in to change notification settings - Fork 72
[torchlib] Fix pow.Tensor_Scalar type promotion #2335
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
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.
Pull Request Overview
This PR fixes type promotion in the pow.Tensor_Scalar operation by ensuring that both inputs to the Pow operator have matching dtypes. In addition, it updates related tests and improves IR string representation and enum capabilities.
- Updated tests in torch_lib to cover various tensor-scalar pow operations.
- Added a new is_floating_point method to the data type enum.
- Modified the aten_pow_tensor_scalar implementation to handle type promotion for both floating point and integer cases.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
tests/function_libs/torch_lib/e2e_ops_tests.py | Updated test cases to assert ONNX program outputs for various pow scenarios. |
onnxscript/ir/_enums.py | Added a new is_floating_point method for better data type handling. |
onnxscript/ir/_core.py | Refactored the usage of _short_tensor_str for cleaner IR string representation. |
onnxscript/function_libs/torch_lib/ops/core.py | Revised aten_pow_tensor_scalar to include explicit type promotion logic. |
❌ 4 Tests Failed:
View the top 3 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
Migration of changes in microsoft/onnxscript#2335 Signed-off-by: Justin Chu <justinchuby@users.noreply.github.com>
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.
Have we already deprecated type promotion in exporter? I don't remember the status of type promotion.
Migration of changes in microsoft/onnxscript#2335 Signed-off-by: Justin Chu <justinchuby@users.noreply.github.com>
Fix pow.Tensor_Scalar type promotion by accounting different combination of input dtypes. This change ensures the inputs to Pow is always the same type for compatibility with downstream tools.
Also
Fix #2213