anirudh2290 commented on a change in pull request #11573: Add stable nrm2
Reducer
URL: https://github.com/apache/incubator-mxnet/pull/11573#discussion_r201541083
##########
File path: tests/python/unittest/test_operator.py
##########
@@ -3051,30 +3061,31 @@ def l2norm(input_data, axis=0, keepdims=True):
for i in range(in_data_dim):
norm_sym = mx.symbol.norm(data=data, ord=order, axis=i,
keepdims=True)
npy_out = l1norm(in_data, i) if order is 1 else
l2norm(in_data, i)
- npy_out_backward = np.sign(in_data) if order is 1 else
in_data/npy_out
+ npy_out_backward = np.sign(in_data) if order is 1 else
in_data/npy_out
check_symbolic_forward(norm_sym, [in_data], [npy_out],
rtol=1e-2 if dtype is np.float16 else
1e-5,
atol=1e-2 if dtype is np.float16 else
1e-5, ctx=ctx)
check_symbolic_backward(norm_sym, [in_data],
[np.ones(npy_out.shape)],
[npy_out_backward],
rtol=1e-2 if dtype is np.float16 else
1e-5,
atol=1e-2 if dtype is np.float16 else
1e-5, ctx=ctx)
- # check gradient
- check_numeric_gradient(norm_sym, [in_data],
numeric_eps=epsilon, rtol=1e-2, atol=1e-3)
- if i < in_data_dim-1:
- norm_sym = mx.symbol.norm(data=data, ord=order, axis=(i,
i+1), keepdims=True)
- npy_out = l1norm(in_data, (i, i+1)) if order is 1 else
l2norm(in_data, (i, i+1))
- npy_out_backward = np.sign(in_data) if order is 1 else
in_data/npy_out
- check_symbolic_forward(norm_sym, [in_data], [npy_out],
- rtol=1e-2 if dtype is np.float16
else 1e-5,
- atol=1e-2 if dtype is np.float16
else 1e-5, ctx=ctx)
- check_symbolic_backward(norm_sym, [in_data],
[np.ones(npy_out.shape)],
- [npy_out_backward],
- rtol=1e-2 if dtype is np.float16
else 1e-5,
- atol=1e-2 if dtype is np.float16
else 1e-5, ctx=ctx)
- # check gradient
- check_numeric_gradient(norm_sym, [in_data],
numeric_eps=epsilon, rtol=1e-2, atol=1e-3)
-
+ # Disable numeric gradient
https://github.com/apache/incubator-mxnet/issues/11509
+ # # check gradient
Review comment:
Is this supposed to be commented. Did this not help for #11509 ?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services