-
Notifications
You must be signed in to change notification settings - Fork 364
feat: expose IResizeLayer in dynamo.conversion.impl #2488
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 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
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
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
if out_shape is not None: | ||
resize_layer.shape = list(input.shape)[:2] + list(out_shape) | ||
else: | ||
resize_layer.scales = [1, 1] + list(scale_factor) |
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.
Should both branches of the conditional ensure that both shape
and scales
are set, or can TRT handle cases where only one is set?
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.
@gs-olive
Looks like there are some internal assertions in Pytorch that checks the arguments for shape
and scales
.
So pytorch will throws out an error if none of them is set or both of them are set.
Since this is a converter so we assumes that the arguments are valid or pytorch will throw out error right?
Please correct me if I'm wrong, thanks!
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.
Our converters come from the schema. The decorator's key
should be one of the scheme's functions.
9e2cc48
to
f538a97
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.
Added a few suggestions, but overall looks good! Could you also add support for the non-vec
variants, such as upsample_bilinear2d
.
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 overall - added minor comment about mypy
linting. Also needs a rebase onto the latest main
to resolve merge conflicts
@gs-olive Any idea why this happens?
|
@bowang007 - actually, I realized the |
In that case, how can we add converter for |
We can add this converter using the decorator |
yeah that makes sense! Thanks! |
aeb73f3
to
a2680d0
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.
Just needs a rebase, then looks good to me
a2680d0
to
f08e370
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:
--- /home/runner/work/TensorRT/TensorRT/py/torch_tensorrt/dynamo/conversion/aten_ops_converters.py 2023-12-09 01:40:38.396894+00:00
+++ /home/runner/work/TensorRT/TensorRT/py/torch_tensorrt/dynamo/conversion/aten_ops_converters.py 2023-12-09 01:42:26.080943+00:00
@@ -2502,6 +2502,6 @@
input=args[0],
out_shape=args_bounds_check(args, 1),
scale_factors=args_bounds_check(args, 3),
resize_mode="bilinear",
align_corners=args_bounds_check(args, 2),
- )
\ No newline at end of file
+ )
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:
--- /home/runner/work/TensorRT/TensorRT/py/torch_tensorrt/dynamo/conversion/aten_ops_converters.py 2023-12-09 01:41:43.828878+00:00
+++ /home/runner/work/TensorRT/TensorRT/py/torch_tensorrt/dynamo/conversion/aten_ops_converters.py 2023-12-09 01:43:31.367921+00:00
@@ -2502,6 +2502,6 @@
input=args[0],
out_shape=args_bounds_check(args, 1),
scale_factors=args_bounds_check(args, 3),
resize_mode="bilinear",
align_corners=args_bounds_check(args, 2),
- )
\ No newline at end of file
+ )
f08e370
to
960458f
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
Description
#2219
Type of change
Expose IResizeLayer in dynamo.conversion.impl
Checklist: