@@ -279,9 +279,9 @@ def test_lstm():
279
279
x_t = input_value [i ]
280
280
i_t = expit (np .dot (x_t , lstm .w_xi .get_value ()) + np .dot (h_t , lstm .w_hi .get_value ()) + np .dot (c_t , lstm .w_ci .get_value ()) + lstm .b_i .get_value ())
281
281
f_t = expit (np .dot (x_t , lstm .w_xf .get_value ()) + np .dot (h_t , lstm .w_hf .get_value ()) + np .dot (c_t , lstm .w_cf .get_value ()) + lstm .b_f .get_value ())
282
- c_t = f_t * c_t + i_t * expit (np .dot (x_t , lstm .w_xc .get_value ()) + np .dot (h_t , lstm .w_hc .get_value ()) + lstm .b_c .get_value ())
282
+ c_t = f_t * c_t + i_t * np . tanh (np .dot (x_t , lstm .w_xc .get_value ()) + np .dot (h_t , lstm .w_hc .get_value ()) + lstm .b_c .get_value ())
283
283
o_t = expit (np .dot (x_t , lstm .w_xo .get_value ()) + np .dot (h_t , lstm .w_ho .get_value ()) + np .dot (c_t , lstm .w_co .get_value ()) + lstm .b_o .get_value ())
284
- h_t = o_t * expit (c_t )
284
+ h_t = o_t * np . tanh (c_t )
285
285
286
286
assert h_t .shape == (hidden_dim ,)
287
287
np .testing .assert_array_almost_equal (
@@ -324,9 +324,9 @@ def test_lstm():
324
324
x_t = input_value_dimshuffled [i ]
325
325
i_t = expit (np .dot (x_t , lstm .w_xi .get_value ()) + np .dot (h_t , lstm .w_hi .get_value ()) + np .dot (c_t , lstm .w_ci .get_value ()) + lstm .b_i .get_value ())
326
326
f_t = expit (np .dot (x_t , lstm .w_xf .get_value ()) + np .dot (h_t , lstm .w_hf .get_value ()) + np .dot (c_t , lstm .w_cf .get_value ()) + lstm .b_f .get_value ())
327
- c_t = f_t * c_t + i_t * expit (np .dot (x_t , lstm .w_xc .get_value ()) + np .dot (h_t , lstm .w_hc .get_value ()) + lstm .b_c .get_value ())
327
+ c_t = f_t * c_t + i_t * np . tanh (np .dot (x_t , lstm .w_xc .get_value ()) + np .dot (h_t , lstm .w_hc .get_value ()) + lstm .b_c .get_value ())
328
328
o_t = expit (np .dot (x_t , lstm .w_xo .get_value ()) + np .dot (h_t , lstm .w_ho .get_value ()) + np .dot (c_t , lstm .w_co .get_value ()) + lstm .b_o .get_value ())
329
- h_t = o_t * expit (c_t )
329
+ h_t = o_t * np . tanh (c_t )
330
330
331
331
assert h_t .shape == (input_value .shape [0 ], hidden_dim )
332
332
np .testing .assert_array_almost_equal (output .eval ({input : input_value }), h_t , decimal = 3 )
@@ -727,16 +727,16 @@ def test_conv2d_layer_kmax_pooling():
727
727
"""
728
728
"""
729
729
730
- test_hidden_layer ()
731
- test_embedding_layer ()
732
- test_rnn ()
730
+ # test_hidden_layer()
731
+ # test_embedding_layer()
732
+ # test_rnn()
733
733
test_lstm ()
734
- test_kmax_pooling_layer_1 ()
735
- test_kmax_pooling_layer_2 ()
736
- test_conv1d_layer ()
737
- test_conv2d_layer ()
738
- test_conv1d_layer_kmax_pooling ()
739
- test_conv2d_layer_kmax_pooling ()
734
+ # test_kmax_pooling_layer_1()
735
+ # test_kmax_pooling_layer_2()
736
+ # test_conv1d_layer()
737
+ # test_conv2d_layer()
738
+ # test_conv1d_layer_kmax_pooling()
739
+ # test_conv2d_layer_kmax_pooling()
740
740
741
741
742
742
exit ()
0 commit comments