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

Try this:

import tensorflow as tf 

Then add a softmax layer in this way:

model.add(Activation(tf.nn.softmax))

The reason why assert this error is version of tensorflow and keras is mismatch. I have slove this problem:

pip install tensorflow==1.5.0

If you donot want to downdegree keras, tf 1.5.0 is the first version that support softmax(axis=axis).


Upgrade your tensoflow and Keras libraries to latest versions. Lower versions don't support softmax axis. Make sure you are upgrading them in the environment in which you are running the program (very important).