-
Notifications
You must be signed in to change notification settings - Fork 7
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
Add decomposition for Grid_Sample and Floor op #54
base: main
Are you sure you want to change the base?
Conversation
ffbf66b
to
ea03475
Compare
|
||
# Compute integer pixel indices for bilinear interpolation | ||
if mode == 'bilinear': | ||
x0 = tvm.relay.floor(x).astype("int32") |
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.
Do we need to do a type cast?
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.
Yes, if it's not typecasted we are ending up with dtype mismatch later.
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.
I see. Let's print out a warning as well.
863f508
to
7cec18c
Compare
7cec18c
to
8aed232
Compare
|
||
# Compute integer pixel indices for bilinear interpolation | ||
if mode == 'bilinear': | ||
x0 = tvm.relay.floor(x).astype("int32") |
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.
I see. Let's print out a warning as well.
Decomposition for torch.grid_sample and torch.floor op has been added.
Grid Sample op decomposition has been adapted from bilinear grid sample from here.
Currently this decomposition supports bilinear interpolation mode with 4d input shapes only, nearest interpolation mode and 5d inputs support will be added later.
The change in DecomposeMultiDimSqueeze callback has been added to handle this failure when squeeze_() was used.
TypeError: 'NoneType' object is not iterable
So in that cases, all dimensions with value 1 will be squeezed.