Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
[MXNET-751] fix ce_loss flaky (#11971)
Browse files Browse the repository at this point in the history
* add xavier initializer

* remove comment line
  • Loading branch information
lanking520 authored and nswamy committed Aug 2, 2018
1 parent 31c5fbc commit a93905d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tests/python/unittest/test_loss.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ 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)
# tracked at: https://github.com/apache/incubator-mxnet/issues/11692
@with_seed()
def test_ce_loss():
nclass = 10
N = 20
Expand All @@ -78,7 +79,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


Expand Down

0 comments on commit a93905d

Please sign in to comment.