richliao / textClassifier

Text classifier for Hierarchical Attention Networks for Document Classification
Apache License 2.0
1.07k stars 379 forks source link

textClassifierRNN.py #9

Open followsun opened 7 years ago

followsun commented 7 years ago

File "/usr/local/lib/python3.5/dist-packages/keras/models.py", line 455, in add output_tensor = layer(self.outputs[0]) File "/usr/local/lib/python3.5/dist-packages/keras/engine/topology.py", line 554, in call output = self.call(inputs, **kwargs) File "/home/l148/xuyang/workshop/EEGDNN/Motor imagery classification/seg_CSP_ConvLSTM_debug.py", line 112, in call eij = K.tanh(K.dot(x,self.W)) File "/usr/local/lib/python3.5/dist-packages/keras/backend/tensorflow_backend.py", line 838, in dot y_permute_dim = [y_permute_dim.pop(-2)] + y_permute_dim IndexError: pop index out of range

xiaoleihuang commented 7 years ago

I got a similar error... IndexError: pop index out of range

IndexError Traceback (most recent call last)

in () 4 l_lstm = Bidirectional(LSTM(100, return_sequences=True))(embedded_sequences) 5 l_dense = TimeDistributed(Dense(200))(l_lstm) ----> 6 l_att = AttLayer()(l_dense) 7 sentEncoder = Model(sentence_input, l_att) 8 /anaconda3/lib/python3.6/site-packages/keras/engine/topology.py in __call__(self, inputs, **kwargs) 552 553 # Actually call the layer, collecting output(s), mask(s), and shape(s). --> 554 output = self.call(inputs, **kwargs) 555 output_mask = self.compute_mask(inputs, previous_mask) 556 in call(self, x, mask) 20 21 def call(self, x, mask=None): ---> 22 eij = K.tanh(K.dot(x, self.W)) 23 24 ai = K.exp(eij) /anaconda3/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py in dot(x, y) 836 y_shape = tuple(y_shape) 837 y_permute_dim = list(range(ndim(y))) --> 838 y_permute_dim = [y_permute_dim.pop(-2)] + y_permute_dim 839 xt = tf.reshape(x, [-1, x_shape[-1]]) 840 yt = tf.reshape(tf.transpose(y, perm=y_permute_dim), [y_shape[-2], -1]) IndexError: pop index out of range
rucJuanLi commented 7 years ago

I think maybe you should use Theano backend.