-
Notifications
You must be signed in to change notification settings - Fork 365
fix: Add automatic type promotion for FX elementwise ops #2055
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.
Code conforms to C++ style guidelines
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.
Code conforms to Python style guidelines
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.
Code conforms to Python style guidelines
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.
Code conforms to C++ style guidelines
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.
Code conforms to Python style guidelines
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.
Code conforms to C++ style guidelines
546f975
to
c8a9559
Compare
9cc2d9d
to
24f4781
Compare
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.
Code conforms to C++ style guidelines
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.
Code conforms to Python style guidelines
24f4781
to
a5b3fae
Compare
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.
Code conforms to C++ style guidelines
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.
Code conforms to Python style guidelines
18e503b
to
2caac76
Compare
a5b3fae
to
d15962e
Compare
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.
Code conforms to C++ style guidelines
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.
There are some changes that do not conform to Python style guidelines:
--- py/torch_tensorrt/fx/converters/impl/elementwise/base.py 2023-07-06 22:40:20.742725 +0000
+++ py/torch_tensorrt/fx/converters/impl/elementwise/base.py 2023-07-06 22:40:40.009356 +0000
@@ -127,11 +127,12 @@
lhs_val = get_trt_tensor(network, lhs_val, f"{name}_lhs", lhs_dtype)
rhs_val = get_trt_tensor(network, rhs_val, f"{name}_rhs", rhs_dtype)
promoted_type = torch.promote_types(
- unified_dtype_converter(lhs_val.dtype, Frameworks.TORCH), unified_dtype_converter(rhs_val.dtype, Frameworks.TORCH)
+ unified_dtype_converter(lhs_val.dtype, Frameworks.TORCH),
+ unified_dtype_converter(rhs_val.dtype, Frameworks.TORCH),
)
trt_promoted_type = unified_dtype_converter(promoted_type, Frameworks.TRT)
if trt_promoted_type != lhs_val.dtype:
lhs_val = cast_trt_tensor(network, lhs_val, trt_promoted_type, name)
- Implement functionality to cast tensors to alternative types - Add functionality to elementwise ops to promote types and perform necessary casts - Address issues in FX ops where mixed-precision computations can cause errors - Add test cases to validate fix
d15962e
to
a720f5d
Compare
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.
Code conforms to Python style guidelines
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.
Code conforms to C++ style guidelines
Closed as changes were merged into Dynamo #2070 |
Description
Fixes #1995
Type of change
Checklist: