-
Notifications
You must be signed in to change notification settings - Fork 6.8k
fix test_activation by lowering threshold + validate eps for check_numeric_gradient #12560
fix test_activation by lowering threshold + validate eps for check_numeric_gradient #12560
Conversation
@@ -292,7 +291,7 @@ def check_activation_training(stype): | |||
in_location = [mx.nd.array(data_tmp).tostype(stype)] | |||
|
|||
test = mx.symbol.Activation(data, act_type="relu") | |||
check_numeric_gradient(test, in_location, numeric_eps=1e-2, rtol=0.16, atol=1e-4) | |||
check_numeric_gradient(test, in_location, numeric_eps=1e-5, rtol=0.16, atol=1e-4) |
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.
Isn't this almost an exact fix as in #12418 that didn't solve the problem?
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's a significant difference between using 1e-5 vs 1e-6. I commented in #12377. in short, you should never use anything less than 1e-5 as the floats do not have enough precision to calculate the difference in the numerator.
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.
Ok, thanks for the explanation!
Thanks for your contribution @azai91 @mxnet-label-bot[pr-awaiting-review] |
@@ -292,7 +291,7 @@ def check_activation_training(stype): | |||
in_location = [mx.nd.array(data_tmp).tostype(stype)] | |||
|
|||
test = mx.symbol.Activation(data, act_type="relu") | |||
check_numeric_gradient(test, in_location, numeric_eps=1e-2, rtol=0.16, atol=1e-4) | |||
check_numeric_gradient(test, in_location, numeric_eps=1e-5, rtol=0.16, atol=1e-4) |
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.
Ok, thanks for the explanation!
Flagging for @anirudh2290 @sandeep-krishnamurthy @nswamy for review/merge. |
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! LGTM.
Description
Address problem with #12377 by setting threshold my appropriately. Ran test with 10000 random seeds and did not produce error.
Checklist
Essentials
Please feel free to remove inapplicable items for your PR.
Changes
Comments