当我运行此代码时,我收到以下错误
model=Sequential()
model.add(LSTM(output_dim=32,input_shape=(200,304),return_sequences=True,activation='sigmoid',inner_activation='hard_sigmoid'))
model.add(Dropout(0.5))
model.add(TimeDistributed(Dense(4)))
model.add(Activation('softmax'))
model.compile(loss='sparse_categorical_crossentropy',optimizer='adagrad',metrics=['accuracy'])
错误是:
C:\Users\vicky\Anaconda3\lib\site-packages\keras\backend\tensorflow_backend.py in sparse_categorical_crossentropy(output, target, from_logits)
1991 if len(output_shape) == 3:
1992 # if our output includes timesteps we need to reshape
-> 1993 return tf.reshape(res, [-1, int(output_shape[-2])])
1994 else:
1995 return res
TypeError: __int__ returned non-int (type NoneType)