Skip to content

Commit eb3f6f9

Browse files
committed
Merge pull request lisa-lab#123 from nouiz/master2
LSTM update and update timming.
2 parents 0d80529 + 8b1e2b3 commit eb3f6f9

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Diff for: code/lstm.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ def train_lstm(
569569
f_update(lrate)
570570

571571
if numpy.isnan(cost) or numpy.isinf(cost):
572-
print 'NaN detected'
572+
print 'bad cost detected: ', cost
573573
return 1., 1., 1.
574574

575575
if numpy.mod(uidx, dispFreq) == 0:
@@ -595,7 +595,7 @@ def train_lstm(
595595

596596
history_errs.append([valid_err, test_err])
597597

598-
if (uidx == 0 or
598+
if (best_p is None or
599599
valid_err <= numpy.array(history_errs)[:,
600600
0].min()):
601601

Diff for: code/test.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def speed():
8787
# 7.1-2 (python 2.7.2, mkl unknow). BLAS with only 1 thread.
8888

8989
expected_times_64 = numpy.asarray([9.8, 22.0, 76.1, 73.7, 116.4,
90-
346.9, 355.0, 558.1, 130.4, 50.8, 113.6])
90+
346.9, 355.0, 558.1, 130.4, 23.2, 106])
9191
expected_times_32 = numpy.asarray([8.1, 17.9, 42.5, 66.5, 71,
9292
191.2, 199.0, 432.8, 119.5, 36.9, 78.0])
9393

@@ -110,7 +110,7 @@ def speed():
110110

111111
expected_times_gpu = numpy.asarray([3.0, 7.55523491, 18.99226785,
112112
5.8, 20.0,
113-
11.8, 18.2, 280.1, 132.8, 38.8, 10.5])
113+
11.2, 17.2, 257.7, 118.8, 34.2, 8.7])
114114
expected_times_64 = [s for idx, s in enumerate(expected_times_64)
115115
if to_exec[idx]]
116116
expected_times_32 = [s for idx, s in enumerate(expected_times_32)

0 commit comments

Comments
 (0)