You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by zh...@apache.org on 2018/07/01 01:30:00 UTC

[incubator-mxnet] branch master updated: [MXNET-615] Fix for flaky test_svmoutput_with_type (#11505)

This is an automated email from the ASF dual-hosted git repository.

zhasheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git


The following commit(s) were added to refs/heads/master by this push:
     new 06a18ab  [MXNET-615] Fix for flaky test_svmoutput_with_type (#11505)
06a18ab is described below

commit 06a18abc3b8a37407bc470eda41ca4ce7e4707f3
Author: Rakesh Vasudevan <ra...@gmail.com>
AuthorDate: Sat Jun 30 18:29:52 2018 -0700

    [MXNET-615] Fix for flaky test_svmoutput_with_type (#11505)
    
    * Fix for flaky test_svmoutput_with_type
    
    * make pylint happy
    
    * make pylint happy
    
    * make pylint happy
    
    * Update test_operator_gpu.py
---
 python/mxnet/test_utils.py            | 12 +++++++++---
 tests/python/gpu/test_operator_gpu.py |  3 +--
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/python/mxnet/test_utils.py b/python/mxnet/test_utils.py
index ae5a473..e963d15 100644
--- a/python/mxnet/test_utils.py
+++ b/python/mxnet/test_utils.py
@@ -1206,7 +1206,7 @@ def check_speed(sym, location=None, ctx=None, N=20, grad_req=None, typ="whole",
 
 def check_consistency(sym, ctx_list, scale=1.0, grad_req='write',
                       arg_params=None, aux_params=None, tol=None,
-                      raise_on_err=True, ground_truth=None, equal_nan=False):
+                      raise_on_err=True, ground_truth=None, equal_nan=False, use_uniform=False):
     """Check symbol gives the same output for different running context
 
     Parameters
@@ -1219,7 +1219,10 @@ def check_consistency(sym, ctx_list, scale=1.0, grad_req='write',
         Standard deviation of the inner normal distribution. Used in initialization.
     grad_req : str or list of str or dict of str to str
         Gradient requirement.
-
+    use_unifrom: bool
+        Optional, When flag set to true,
+        random input data generated follows uniform distribution,
+        not normal distribution
     Examples
     --------
     >>> # create the symbol
@@ -1279,7 +1282,10 @@ def check_consistency(sym, ctx_list, scale=1.0, grad_req='write',
     aux_params = {} if aux_params is None else aux_params
     for n, arr in exe_list[0].arg_dict.items():
         if n not in arg_params:
-            arg_params[n] = np.random.normal(size=arr.shape, scale=scale)
+            if use_uniform:
+                arg_params[n] = np.random.uniform(low=-0.92, high=0.92, size=arr.shape)
+            else:
+                arg_params[n] = np.random.normal(size=arr.shape, scale=scale)
     for n, arr in exe_list[0].aux_dict.items():
         if n not in aux_params:
             aux_params[n] = 0
diff --git a/tests/python/gpu/test_operator_gpu.py b/tests/python/gpu/test_operator_gpu.py
index 3efc284..a995250 100644
--- a/tests/python/gpu/test_operator_gpu.py
+++ b/tests/python/gpu/test_operator_gpu.py
@@ -1233,7 +1233,6 @@ def test_embedding_with_type():
     test_embedding_helper(data_types, weight_types, 0, 5)
 
 
-@unittest.skip("test fails intermittently. temporarily disabled till it gets fixed. tracked at https://github.com/apache/incubator-mxnet/issues/8288")
 @with_seed()
 def test_svmoutput_with_type():
     sym = mx.sym.SVMOutput(name='svmoutput', use_linear=True)
@@ -1243,7 +1242,7 @@ def test_svmoutput_with_type():
                 {'ctx': mx.cpu(0), 'svmoutput_data': (20, 10), 'type_dict': {'svmoutput_data': np.float64}},
                 {'ctx': mx.cpu(0), 'svmoutput_data': (20, 10), 'type_dict': {'svmoutput_data': np.float32}},
                 {'ctx': mx.cpu(0), 'svmoutput_data': (20, 10), 'type_dict': {'svmoutput_data': np.float16}}]
-    check_consistency(sym, ctx_list)
+    check_consistency(sym, ctx_list, use_uniform=True)
 
 
 @with_seed()