Skip to content

Commit

Permalink
Bug fix: use max_length instead of true length for seq lengths
Browse files Browse the repository at this point in the history
  • Loading branch information
cgpotts committed Apr 18, 2018
1 parent 25e3c34 commit 374b725
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tf_rnn_classifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,8 @@ def _convert_X(self, X):
index = dict(zip(self.vocab, range(len(self.vocab))))
unk_index = index['$UNK']
for i in range(new_X.shape[0]):
ex_lengths.append(len(X[i]))
ex_len = min([len(X[i]), self.max_length])
ex_lengths.append(ex_len)
vals = X[i][-self.max_length: ]
vals = [index.get(w, unk_index) for w in vals]
temp = np.zeros((self.max_length,), dtype='int')
Expand Down

0 comments on commit 374b725

Please sign in to comment.