@@ -1909,10 +1909,12 @@ def test_depthwise_convolution():
1909
1909
1910
1910
@with_seed ()
1911
1911
def test_convolution_independent_gradients ():
1912
- ctx = default_context ()
1913
- # set a low bar for autotuned cudnn conv
1914
- atol = 1.0e-1 if ctx .device_type == "gpu" else 1.0e-3
1915
- rtol = 1.0e-2 if ctx .device_type == "gpu" else 1.0e-3
1912
+ # NOTE(zixuanweeei): Flaky test tracked by https://github.com/apache/incubator-mxnet/issues/15603.
1913
+ # GPU context will be enabled after figuring out the possible issue tracked at
1914
+ # https://github.com/apache/incubator-mxnet/issues/15638.
1915
+ ctx = mx .cpu ()
1916
+ atol = 1.0e-3
1917
+ rtol = 1.0e-3
1916
1918
reqs = ["null" , "write" , "add" ]
1917
1919
var_names = ["x" , "w" , "b" ]
1918
1920
dims = [1 , 2 ]
@@ -1942,14 +1944,14 @@ def test_convolution_independent_gradients():
1942
1944
for req_kind in reqs :
1943
1945
# Binding args for conv with possible dependent gradients
1944
1946
base_args = {
1945
- 'x' : mx .nd .random .normal (shape = x_shape ),
1946
- 'w' : mx .nd .random .normal (shape = w_shape ),
1947
- 'b' : mx .nd .random .normal (shape = (num_filter , )) if not no_bias else None }
1947
+ 'x' : mx .nd .random .normal (shape = x_shape , ctx = ctx ),
1948
+ 'w' : mx .nd .random .normal (shape = w_shape , ctx = ctx ),
1949
+ 'b' : mx .nd .random .normal (shape = (num_filter , ), ctx = ctx ) if not no_bias else None }
1948
1950
args1 = copy .deepcopy (base_args )
1949
1951
grad1 = {
1950
- 'x' : mx .nd .zeros (shape = x_shape ),
1951
- 'w' : mx .nd .zeros (shape = w_shape ),
1952
- 'b' : mx .nd .zeros (shape = (num_filter , )) if not no_bias else None }
1952
+ 'x' : mx .nd .zeros (shape = x_shape , ctx = ctx ),
1953
+ 'w' : mx .nd .zeros (shape = w_shape , ctx = ctx ),
1954
+ 'b' : mx .nd .zeros (shape = (num_filter , ), ctx = ctx ) if not no_bias else None }
1953
1955
1954
1956
grad_req1 = [req_kind ] * 3
1955
1957
grad_req1 = dict (zip (var_names , grad_req1 ))
@@ -1962,9 +1964,9 @@ def test_convolution_independent_gradients():
1962
1964
# Binding args for conv with independent gradients
1963
1965
args2 = copy .deepcopy (base_args ) # Deepcopy the same params of `exe1`
1964
1966
grad2 = {
1965
- 'x' : mx .nd .zeros (shape = x_shape ),
1966
- 'w' : mx .nd .zeros (shape = w_shape ),
1967
- 'b' : mx .nd .zeros (shape = (num_filter , )) if not no_bias else None }
1967
+ 'x' : mx .nd .zeros (shape = x_shape , ctx = ctx ),
1968
+ 'w' : mx .nd .zeros (shape = w_shape , ctx = ctx ),
1969
+ 'b' : mx .nd .zeros (shape = (num_filter , ), ctx = ctx ) if not no_bias else None }
1968
1970
grad_req2 = {"x" : x_req , "w" : w_req , "b" : b_req }
1969
1971
exe2 = conv .bind (ctx , args2 , args_grad = grad2 , grad_req = grad_req2 )
1970
1972
0 commit comments