access2rohit commented on a change in pull request #16885: Multi Precision Lamb
Update operator
URL: https://github.com/apache/incubator-mxnet/pull/16885#discussion_r355630163
##########
File path: tests/python/gpu/test_operator_gpu.py
##########
@@ -422,6 +422,65 @@ def test_preloaded_multi_sgd():
shapes = [np.random.randint(1, maxdim + 1, size=maxndim) for i
in range(nparam)]
check_preloaded_multi_sgd(dtype, shapes, momentum,
use_master_weights)
+
+def check_multi_lamb(dtype, shapes, use_master_weights):
+ def _flatten_list(nested_list):
+ return [item for sublist in nested_list for item in sublist]
+ weights_arr = [np.random.rand(*shape).astype(dtype) * 100. for shape in
shapes]
+ grads_arr = [np.random.rand(*shape).astype(dtype) * 100. for shape in
shapes]
+ means_arr = [np.random.rand(*shape).astype(dtype) * 100. for shape in
shapes]
+ variences_arr = [np.random.rand(*shape).astype(dtype) * 100. for shape in
shapes]
+ rescale_grad = (np.random.random() + 1.0)
+ mx_w = _make_ndarrays(weights_arr)
+ mx_g = _make_ndarrays(grads_arr)
+ mx_m = _make_ndarrays(means_arr)
+ mx_v = _make_ndarrays(variences_arr)
+ mx_p_w = _make_ndarrays(weights_arr)
+ mx_p_g = _make_ndarrays(grads_arr)
+ lrs = list((np.random.random(size=len(shapes)).astype('float32') + 0.1) /
100.)
+ mx_lrs = mx.nd.array(lrs, dtype='float32', ctx=mx.gpu(0))
+ wds = list((np.random.random(size=len(shapes)).astype('float32') + 0.1) /
1000.)
+ mx_wds = mx.nd.array(wds, dtype='float32', ctx=mx.gpu(0))
+
+ if use_master_weights:
+ weights32_arr = [arr.astype('float32') for arr in weights_arr]
+ mx_w32 = _make_ndarrays(weights32_arr)
+ mx_p_w32 = _make_ndarrays(weights32_arr)
+
+ mx.nd.multi_mp_lamb_update(
Review comment:
forgot to remove old code :P
just removed
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services