-
Notifications
You must be signed in to change notification settings - Fork 369
feat: support more elementwise and unary dynamo converters #2429
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
feat: support more elementwise and unary dynamo converters #2429
Conversation
gs-olive
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.
Overall looks good - had a few questions and suggestions as mentioned in the comments
5c88118 to
1b077ca
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.
Looks good to me overall! One question - should convert_binary_elementwise also be allowed to handle bool types?
Also - a rebase may be needed to avoid the CircleCI errors.
a210762 to
1645b5e
Compare
Yes, I agree with you. Fixed! Thanks for the comments. |
gs-olive
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.
Just a minor comment, bool should likely be added here, to lines 123 + 127 since this PR adds support for bool in convert_binary_elementwise:
TensorRT/py/torch_tensorrt/dynamo/conversion/impl/elementwise/base.py
Lines 123 to 130 in 867dc7b
| if is_lhs_trt_tensor and isinstance(rhs_val, (float, int)): | |
| rhs_val = np.array( | |
| [rhs_val], dtype=unified_dtype_converter(lhs_dtype, Frameworks.NUMPY) | |
| ) | |
| if is_rhs_trt_tensor and isinstance(lhs_val, (float, int)): | |
| lhs_val = np.array( | |
| [lhs_val], dtype=unified_dtype_converter(rhs_dtype, Frameworks.NUMPY) | |
| ) |
Otherwise, seems good to go!
Description
Support more elementwise and unary dynamo converters.
For
bitwise_opconverters, TensorRT doesn't support bitwise ops. Thus, if inputs areintvalues, they will fall back to pytorch. If inputs arebool, they will be converted with the help oflogical_op.Fixes #2208 #2199
Type of change
Checklist: