Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

When I use this it does not give any error

out_layer = tf.add(tf.matmul(layer_4 , weights['out']) , biases['out'])
out_layer = tf.nn.softmax(out_layer)

But when I use this

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'))

I get error as

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

What should I do? I am using python2 Thanks

like image 280
Aakash aggarwal Avatar asked Jun 09 '18 16:06

Aakash aggarwal


1 Answers

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).

like image 170
Crisovet Avatar answered Oct 22 '22 03:10

Crisovet