Skip to content Skip to sidebar Skip to footer

Attributeerror: 'nonetype' Object Has No Attribute '_inbound_nodes' In Keras

I want to define my own Lstm model as follows: from keras import backend as K from keras.callbacks import ModelCheckpoint from keras.layers.core import Dense, Activation, Flatten,

Solution 1:

You should use keras.layers.Lambda to wrap K.* operations as a layer instead of K.* function directly.

# change
avg_pool = K.mean(rnn_outputs, axis = 1)
max_pool = K.max(rnn_outputs, axis = 1)
# to
avg_pool = Lambda(lambda x:K.mean(x,axis=1))(rnn_outputs)
max_pool = Lambda(lambda x:K.max(x,axis=1))(rnn_outputs)

Post a Comment for "Attributeerror: 'nonetype' Object Has No Attribute '_inbound_nodes' In Keras"