From 2bd82f92eb2bd2299f1d0fc97d5eaaf9e9d58381 Mon Sep 17 00:00:00 2001 From: Qing Date: Wed, 1 Aug 2018 09:53:05 -0700 Subject: [PATCH 1/2] add xavier initializer --- tests/python/unittest/test_loss.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/python/unittest/test_loss.py b/tests/python/unittest/test_loss.py index 8d5b86341a88..62f8559e9920 100644 --- a/tests/python/unittest/test_loss.py +++ b/tests/python/unittest/test_loss.py @@ -64,7 +64,9 @@ def get_net(num_hidden, flatten=True): fc3 = mx.symbol.FullyConnected(act2, name='fc3', num_hidden=num_hidden, flatten=flatten) return fc3 -@with_seed(1234) +# @lanking520: adding Xavier initializer and problem solved +# tracked at: https://github.com/apache/incubator-mxnet/issues/11692 +@with_seed() def test_ce_loss(): nclass = 10 N = 20 @@ -78,7 +80,8 @@ def test_ce_loss(): loss = mx.sym.make_loss(loss) mod = mx.mod.Module(loss, data_names=('data',), label_names=('label',)) mod.fit(data_iter, num_epoch=200, optimizer_params={'learning_rate': 0.01}, - eval_metric=mx.metric.Loss(), optimizer='adam') + eval_metric=mx.metric.Loss(), optimizer='adam', + initializer=mx.init.Xavier(magnitude=2)) assert mod.score(data_iter, eval_metric=mx.metric.Loss())[0][1] < 0.05 From 9c65d64f204f17d6ece22d5d0880365361c649a0 Mon Sep 17 00:00:00 2001 From: Qing Date: Wed, 1 Aug 2018 11:22:39 -0700 Subject: [PATCH 2/2] remove comment line --- tests/python/unittest/test_loss.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/python/unittest/test_loss.py b/tests/python/unittest/test_loss.py index 62f8559e9920..3c147bc4c723 100644 --- a/tests/python/unittest/test_loss.py +++ b/tests/python/unittest/test_loss.py @@ -64,7 +64,6 @@ def get_net(num_hidden, flatten=True): fc3 = mx.symbol.FullyConnected(act2, name='fc3', num_hidden=num_hidden, flatten=flatten) return fc3 -# @lanking520: adding Xavier initializer and problem solved # tracked at: https://github.com/apache/incubator-mxnet/issues/11692 @with_seed() def test_ce_loss():