You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2019/09/19 16:28:40 UTC

[GitHub] [incubator-mxnet] kshitij12345 commented on a change in pull request #16198: [fix] Update `test_update_ops_mutation` tolerance

kshitij12345 commented on a change in pull request #16198: [fix] Update `test_update_ops_mutation` tolerance
URL: https://github.com/apache/incubator-mxnet/pull/16198#discussion_r326269261
 
 

 ##########
 File path: tests/python/unittest/test_ndarray.py
 ##########
 @@ -1887,14 +1888,16 @@ def check_save_load(save_is_np_shape, load_is_np_shape, shapes, save_throw_excep
     check_save_load(True, True, [(2, 0, 1), (0,), (), (), (0, 4), (), (3, 0, 0, 0), (2, 1), (0, 5, 0)], False, False)
 
 
-@with_seed()
-def test_update_ops_mutation():
-    def assert_mutate(x, y, op):
+def _test_update_ops_mutation_impl():
+    assert_allclose = functools.partial(
+                np.testing.assert_allclose, rtol=1e-10)
 
 Review comment:
   @Vikas-kum @sxjscience Thanks for taking a look.
   
   The new tolerance of `assert_allclose` ([numpy doc](https://docs.scipy.org/doc/numpy/reference/generated/numpy.testing.assert_almost_equal.html) mentions to use `assert_allclose` over `assert_almost_equal`) is now 1e-10, which means that it is more stricter now when checking for NDArray not being changed. 
   
   A consequence of this as it is used in `assert_mutated` is, it also allows smaller updates, i.e. -5.9604645e-08 (failure case update) to be valid change . 
   
   Thus now we have stricter check on whether any element of NDArray has changed or not (with stricter tolerance) while allowing smaller valid updates (i.e. anything above `rtol` of 1e-10 will be a valid update).
   
   > I think it should be I don't care about 7th(or 8th precision or anything above) precision, it can go arbitrary lower than what I care about.
   
   (**I don't know much about this but**) With the instability of floating point number (rounding errors), I guess it is better to have some tolerance like 1e-10. I don't know if it is good idea to go to Machine Epsilon (lowest possible) as `rtol` for this.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services