Fix Bug in Bilinear Interpolation and Add Deform Conv to PT FrontEnd #7397
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.