szha commented on a change in pull request #9977: Cpu lstm inference
URL: https://github.com/apache/incubator-mxnet/pull/9977#discussion_r173371568
 
 

 ##########
 File path: tests/python/unittest/test_gluon_rnn.py
 ##########
 @@ -67,6 +67,22 @@ def test_lstm_forget_bias():
                                forget_bias * np.ones(100, ), np.zeros((2 * 
100,))])
     assert_allclose(mod.get_params()[0][bias_argument].asnumpy(), 
expected_bias)
 
+def test_lstm_cpu_inference():
+    # should behave the same as lstm cell
+    atol = 1e-6
+    x = mx.nd.ones(shape=(2, 2, 2))
+    model = mx.gluon.nn.Sequential()
+    with model.name_scope():
+        model.add(mx.gluon.rnn.LSTM(2, num_layers=6, bidirectional=True))
+    model.initialize(mx.init.One())
 
 Review comment:
   Could you also test the consistency between cpu and gpu, with same random 
weights and random inputs?

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


With regards,
Apache Git Services

Reply via email to