mxnet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [incubator-mxnet] eric-haibin-lin commented on a change in pull request #16885: Multi Precision Lamb Update operator
Date Mon, 09 Dec 2019 18:35:56 GMT
eric-haibin-lin commented on a change in pull request #16885: Multi Precision Lamb Update operator
URL: https://github.com/apache/incubator-mxnet/pull/16885#discussion_r355613668
 
 

 ##########
 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:
   The test case does not make sense. There's no such an op `multi_mp_lamb_update ` in this
PR. 

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message