richliao / textClassifier

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

y_permute_dim.pop(-2) pop index out of range #27

Open imgoodman opened 6 years ago

imgoodman commented 6 years ago

hi, this is an awesome implementation. However, when I use AttLayer, I got an IndexError: pop index out of range. It is found in eij = K.tanh(K.dot(x, self.W)). Then, y_permute_dim =[y_permute_dim.pop(-2)] + y_permute_dim. my keras is 2.1.5. Thanks a lot

blog4me commented 6 years ago

I have same problems in "eij = K.tanh(K.dot(x, self.W))", it says IndexError: pop index out of range, my keras is 1.2.2, can you tell me what's going on?

tianke0711 commented 6 years ago

same problem

tensor-flower commented 5 years ago

same problem

DingYunxia commented 5 years ago

I have encountered the same problem now, how did you solve it?

prabhatkgupta commented 3 years ago

@imgoodman @DingYunxia You can switch Keras backend to Theano. This might be helpful to change the backend of Keras

import keras.backend as K
import importlib
import os

def change_keras_backend(backend):
    if K.backend() != backend:
        os.environ['KERAS_BACKEND'] = backend
        importlib.reload(K)

change_keras_backend("theano")