. Advertisement .
..3..
. Advertisement .
..4..
Here is the program I run:
out_layer = tf.add(tf.matmul(layer_4 , weights['out']) , biases['out'])
out_layer = tf.nn.softmax(out_layer)
model=Sequential()
model.add(Dense(100, input_dim= n_dim,
activation='tanh',kernel_initializer='uniform'))
keras.layers.core.Dropout(0.3, noise_shape=None, seed=None)
model.add(Dense(50,input_dim=1000,activation='sigmoid'))
keras.layers.core.Dropout(0.4, noise_shape=None, seed=None)
model.add(Dense(15,input_dim=500,activation='sigmoid'))
keras.layers.core.Dropout(0.2, noise_shape=None, seed=None)
model.add(Dense(units=n_class))
model.add(Activation('softmax'))
After I run, it returns an error:
TypeError: softmax() got an unexpected keyword argument 'axis'
Does anyone have any suggestions for the problem below: softmax() got an unexpected keyword argument ‘axis’ in the python – How to correct it?
The cause: Tensorflow and Keras version mismatch is reported as the cause of the softmax() got an unexpected keyword argument ‘axis’ error.
Solution:
Use:
Afterwards, apply a softmax layer as follows:
Upgrading your Keras and tensoflow libraries to the latest versions is recommended. Lower versions don’t support softmax axis. It is very important to ensure that you upgrade them in the environment where you run the program.