-
Notifications
You must be signed in to change notification settings - Fork 6.8k
[MXNET-1258]fix unittest for ROIAlign Operator #13609
Conversation
It seems there is a problem in Windows-CPU CI.
|
@mxnet-label-bot add[CI, Flaky, pr-awaiting-review] |
…to fix_roi_align_test
can you run the test >500 times and paste the results here to ensure that the test is no longer flaky. |
@anirudhacharya Thank you. It works fine. |
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 a few unnecessary newlines.
y = max(0.0, y) | ||
return T(0.0), [] | ||
x = T(max(0.0, x)) | ||
y = T(max(0.0, y)) | ||
x_low = int(x) |
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.
why not typecast x_low
to np.float32
here itself and remove the many typecasting statements below?
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.
The type of x_low is int
in the C implementation.
In Python, the default type of float is float64
, however the float type in the C implementation is float32
.
If the types are not consistent, there will be calculation error.
So I use T
to typecast some variables to np.float32
to keep the type consistency between C and Python unittest.
|
||
out[r, c, ph, pw] = val * 1.0 / count | ||
out[r, c, ph, pw] = val / count | ||
assert out.dtype == T, out.dtype |
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.
can you add a more descriptive error message
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.
Thanks! I will add more detail.
@anirudhacharya Can you take a look again? |
LGTM |
@wkcn please rebase and resolve conflicts @mxnet-label-bot update [pr-awaiting-merge] |
@anirudhacharya In my own project, there is also a ROIAlignOP unittest, and I found that nvcc will change the order of operators because of compiler optimization, causing the problem of float precision. So please not merge the PR temporarily, and I will check it. [link] |
@mxnet-label-bot update [pr-work-in-progress] |
@stu1130 Thanks! |
test fail in test activation |
…into fix_roi_align_test
@anirudhacharya @stu1130 |
@anirudhacharya - Can you please a look at this PR? |
@sandeep-krishnamurthy have already approved this PR, above. |
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.
LGTM.
Could you add "Fixes #11064" in the PR description? This will automatically close the issue when the PR is merged
@mxnet-label-bot update [Test, pr-awaiting-merge] |
* fix roi align test * retrigger unittest * add more test detail for ROIAlign test * remove url in test_op_roi_align * remove blank line in test_op_roi_align in test_operator * merge master * Update test_operator.py * retrigger CI
* fix roi align test * retrigger unittest * add more test detail for ROIAlign test * remove url in test_op_roi_align * remove blank line in test_op_roi_align in test_operator * merge master * Update test_operator.py * retrigger CI
* fix roi align test * retrigger unittest * add more test detail for ROIAlign test * remove url in test_op_roi_align * remove blank line in test_op_roi_align in test_operator * merge master * Update test_operator.py * retrigger CI
Description
Fixes #11064
It passes the test whose
MXNET_TEST_SEED=35650200
.The old unittest for ROIAlign computes in
float64
, so there is some float precision problem.Fixes #11064
Checklist
Essentials
Please feel free to remove inapplicable items for your PR.
Changes
float32
in the unittest for ROIAlign OPatol
to1e-5
in the unittest for ROIAlign OPComments