TypeError:softmax()が予期しないキーワード引数 'axis'を取得しました



Typeerror Softmax Got An Unexpected Keyword Argumentaxis



勝利している環境はkeras2.16であり、lstmの実行時にエラーが報告されます

--------------------------------------------------------------------------- TypeError Traceback (most recent call last) in () 7 8 model.add(Dropout(0.2))# random inactivation, avoid over-fitting, during training ----> 9 model.add(Dense(y.shape[1],activation='softmax'))# defines the activation function in the dense layer, the whole is a softmax layer, 10 #### The principle of the softmax layer to be checked, the softmax keras implementation, 11 #y.shape[1] is the length of the dictionary, activation is the activation function, and Dense(y.shape[1], activation='softmax') is an output layer. pip uninstall Keras pip install keras==2.1

解決策:kerasバージョンをロールバックします



keras 2.1.6のsoftmaxにはaxisパラメーターがないため、kerasバージョンをロールバックしました。

TypeError: softmax() got an unexpected keyword argument 'axis'

問題が解決しました