satrana42 / CharSCNN

Implementation of CharSCNN
23 stars 4 forks source link

strange code in CNN.py #3

Open prhbrt opened 8 years ago

prhbrt commented 8 years ago

I noticed this sniplet of code in load.py:

word_mat = [[0]*word_cnt]*(max_sent_len+k_wrd-1)
char_mat = [[[0]*char_cnt]*(max_word_len+k_chr-1)]*(max_sent_len+k_wrd-1)

for i in xrange(len(tokens)):
    word_mat[(k_wrd/2)+i][words_map[tokens[i]]]
    for j in xrange(len(tokens[i])):
        char_mat[(k_wrd/2)+i][(k_chr/2)+j][char_map[tokens[i][j]]]

The for-loops seem like they should do something, but instead they do nothing.

Is there something wrong here?

prhbrt commented 8 years ago

PS: the code is actually in load.py (not cnn.py), but is called when running cnn.py. Sorry for the confusion.

satrana42 commented 8 years ago

If I remember correctly this piece of code originally converted word_mat and char_mat into numpy arrays. Initially we were pickling the data but that'd take a lot of space. We fixed it by returning the data in a function call. Apparently this file has a lot of weird code. Will fix soon.