Skip to content

Commit 906a30e

Browse files
committed
Small comment update
1 parent 9018392 commit 906a30e

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

code/imdb.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ def prepare_data(seqs, labels, maxlen=None):
1414
if maxlen is set, we will cut all sequence to this maximum
1515
lenght.
1616
17+
This swap the axis!
1718
"""
1819
# x: a list of sentences
1920
lengths = [len(s) for s in seqs]

code/lstm.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -481,12 +481,10 @@ def train_lstm(
481481
y = [train[1][t] for t in train_index]
482482
x = [train[0][t]for t in train_index]
483483

484-
# Get the data in numpy.ndarray formet.
485-
# It return something of the shape (minibatch maxlen, n samples)
486-
x, mask, y = prepare_data(x, y, maxlen=maxlen)
487-
if x is None:
488-
print 'Minibatch with zero sample under length ', maxlen
489-
continue
484+
# Get the data in numpy.ndarray format
485+
# This swap the axis!
486+
# Return something of shape (minibatch maxlen, n samples)
487+
x, mask, y = prepare_data(x, y)
490488
n_samples += x.shape[1]
491489

492490
cost = f_grad_shared(x, mask, y)

0 commit comments

Comments
 (0)