From 82ca632f85792692e2382e930244f1948f3c371c Mon Sep 17 00:00:00 2001 From: Roshani Nagmote Date: Tue, 7 Aug 2018 10:29:47 -0700 Subject: [PATCH] Adjusting tolerance level and removing fixed seed for tests: test_ifft, test_fft (#12010) * adjusting tolerance level and removing fixed seed * CI retrigger * removing status --- tests/python/gpu/test_operator_gpu.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/python/gpu/test_operator_gpu.py b/tests/python/gpu/test_operator_gpu.py index 3d799aa5319b..9dbf5f0825a8 100644 --- a/tests/python/gpu/test_operator_gpu.py +++ b/tests/python/gpu/test_operator_gpu.py @@ -127,7 +127,7 @@ def check_ifft(shape): init_complex.real[:,i] = init[0][:,2*i] init_complex.imag[:,i] = init[0][:,2*i+1] a = np.fft.ifft(init_complex, n=None, axis=-1, norm=None) - assert_almost_equal(a.real, out1[0]/shape_old[1],rtol=1e-3, atol=1e-12) + assert_almost_equal(a.real, out1[0]/shape_old[1],rtol=1e-3, atol=1e-5) if len(shape) == 4: init_complex = np.zeros(shape_old,dtype = np.complex64) @@ -135,7 +135,7 @@ def check_ifft(shape): init_complex.real[:,:,:,i] = init[0][:,:,:,2*i] init_complex.imag[:,:,:,i] = init[0][:,:,:,2*i+1] a = np.fft.ifft(init_complex, n=None, axis=-1, norm=None) - assert_almost_equal(a.real, out1[0]/shape_old[3],rtol=1e-3, atol=1e-12) + assert_almost_equal(a.real, out1[0]/shape_old[3],rtol=1e-3, atol=1e-5) # backward if len(shape) == 2: out_grad = mx.nd.empty(shape_old) @@ -148,7 +148,7 @@ def check_ifft(shape): temp[:,i] = exe.grad_arrays[0].asnumpy()[:,2*i] a = np.fft.fft(out_grad.asnumpy(), n=None, axis=-1, norm=None) - assert_almost_equal(a.real, temp, rtol=1e-3, atol=1e-12) + assert_almost_equal(a.real, temp, rtol=1e-3, atol=1e-5) if len(shape) == 4: out_grad = mx.nd.empty(shape_old) out_grad[:] = np.random.normal(-3, 3, shape_old) @@ -160,9 +160,9 @@ def check_ifft(shape): temp[:,:,:,i] = exe.grad_arrays[0].asnumpy()[:,:,:,2*i] a = np.fft.fft(out_grad.asnumpy(), n=None, axis=-1, norm=None) - assert_almost_equal(a.real, temp, rtol=1e-3, atol=1e-12) + assert_almost_equal(a.real, temp, rtol=1e-3, atol=1e-5) -@with_seed(0) +@with_seed() def test_ifft(): nrepeat = 2 maxdim = 10 @@ -194,7 +194,7 @@ def check_fft(shape): for exe in exe_list: for arr, iarr in zip(exe.arg_arrays, init): arr[:] = iarr.astype(arr.dtype) - #forward + # forward for exe in exe_list: exe.forward(is_train=True) out1 = [exe.outputs[0].asnumpy() for exe in exe_list] @@ -221,7 +221,7 @@ def check_fft(shape): a[i,j,:,p+1] = out2[i,j+out1[0].shape[1],:,k] p = p+2 - assert_almost_equal(a, out1[0],rtol=1e-3, atol=1e-6) + assert_almost_equal(a, out1[0],rtol=1e-3, atol=1e-5) # backward if len(shape) == 2: @@ -235,7 +235,7 @@ def check_fft(shape): for exe in exe_list: exe.backward([out_grad]) a = np.fft.ifft(out_grad_complex, n=None, axis=-1, norm=None) - assert_almost_equal(a.real, exe.grad_arrays[0].asnumpy()/shape[1],rtol=1e-3, atol=1e-8) + assert_almost_equal(a.real, exe.grad_arrays[0].asnumpy()/shape[1],rtol=1e-3, atol=1e-5) if len(shape) == 4: out_grad = mx.nd.empty(out1[0].shape) @@ -248,9 +248,9 @@ def check_fft(shape): for exe in exe_list: exe.backward([out_grad]) a = np.fft.ifft(out_grad_complex, n=None, axis=-1, norm=None) - assert_almost_equal(a.real, exe.grad_arrays[0].asnumpy()/shape[3],rtol=1e-3, atol=1e-6) + assert_almost_equal(a.real, exe.grad_arrays[0].asnumpy()/shape[3],rtol=1e-3, atol=1e-5) -@with_seed(0) +@with_seed() def test_fft(): nrepeat = 2 maxdim = 10