Skip to content
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

Fix Bug in Bilinear Interpolation and Add Deform Conv to PT FrontEnd #7397

Merged

Conversation

codeislife99
Copy link
Contributor

@codeislife99 codeislife99 commented Feb 3, 2021

This PR adds deform_conv to PT Frontend. It also fixes a bug in bilinear interpolation which was causing wrong output with deformable convolutions from PT framework. The "bug" occurs when one or more the interpolation index(y, x) is outside one or more of the boundary points (y_max, x_max), but within (y_max + 1, x_max + 1). In the current implementation both interpolation source points are on the boundary even if the point is closer to one or more of (y_max+1, x_max+1). In the corrected version, the first point is on the boundary and the second point value is 0 which is more logically sound and matches with how frameworks have implemented it.
PS : It might seem that this is a corner case, but it really changes the accuracy by a lot
For e.g: Without this change , the relative and absolute tolerances are around 1 and 1e-2 with tolerances being more than 1e-2 for 25-40% of the output elements in deformable convolution.

Since ROI align is dependent on this change, I have made the corresponding necessary changes in ROIAlign and verified that it works like before as expected.

@codeislife99
Copy link
Contributor Author

codeislife99 commented Feb 3, 2021

@codeislife99 codeislife99 marked this pull request as draft February 3, 2021 06:39
@codeislife99 codeislife99 changed the title Fix Bug in Bilinear Interpolation Fix Bug in Bilinear Interpolation and Add Deform Conv to PT FrontEnd Feb 3, 2021
@codeislife99 codeislife99 marked this pull request as ready for review February 3, 2021 10:44
@masahi
Copy link
Member

masahi commented Feb 3, 2021

cc @vinx13

Copy link
Member

@vinx13 vinx13 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

include/tvm/topi/detail/tensor_utils.h Outdated Show resolved Hide resolved
Copy link
Contributor

@anijain2305 anijain2305 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@anijain2305 anijain2305 merged commit 38c9eb1 into apache:main Feb 5, 2021
@anijain2305
Copy link
Contributor

Thanks @codeislife99 @vinx13 This is merged

alexwong pushed a commit to alexwong/tvm that referenced this pull request Feb 11, 2021
…pache#7397)

* Fix Bug in Bilinear Interpolation

* Add NHWC Tests

* clean

* Fix Bug and Add Deformable Conv PyTorch for completeness

* Add Tensor Utils

* Remove stuff

* Include vector

* PR Comments

* Empty Commit for CI

Co-authored-by: Ubuntu <[email protected]>
Lokiiiiii pushed a commit to Lokiiiiii/tvm that referenced this pull request Mar 2, 2021
…pache#7397)

* Fix Bug in Bilinear Interpolation

* Add NHWC Tests

* clean

* Fix Bug and Add Deformable Conv PyTorch for completeness

* Add Tensor Utils

* Remove stuff

* Include vector

* PR Comments

* Empty Commit for CI

Co-authored-by: Ubuntu <[email protected]>
trevor-m pushed a commit to neo-ai/tvm that referenced this pull request Mar 2, 2021
…pache#7397)

* Fix Bug in Bilinear Interpolation

* Add NHWC Tests

* clean

* Fix Bug and Add Deformable Conv PyTorch for completeness

* Add Tensor Utils

* Remove stuff

* Include vector

* PR Comments

* Empty Commit for CI

Co-authored-by: Ubuntu <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants