title: Softmatx activation in Keras
body: <p>I am new to Keras.</p>
  
  <p>I want to build a CNN network with Keras. </p>
  
  <p>It is fine until I want to add a softmax dense layer. </p>
  
  <p>The error is <code>TypeError: softmax() got an unexpected keyword argument 'axis'</code>.</p>
  
  <p>I searched Keras and tried to fix it:</p>
  
  <pre><code>from keras.layers import Softmax
  output_layer = Dense(units=n_classes, activation=Softmax(axis=-1),  kernel_initializer='uniform')
  </code></pre>
  
  <p>However, it still gives error plus the warning:</p>
  
  <p><code>UserWarning: Do not pass a layer instance (such as Softmax) as the activation argument of another layer. Instead, advanced activation layers should be used just like any other layer in a model.</code></p>
  
  <p>What is the correct method of applying softmax?</p>
  
  <p>Thank you very much.</p>
  
  <pre><code>cnn = Sequential()
  kernelSize = (3, 3)
  ip_activation = 'relu'
  ip_conv_0 = Conv2D(filters=32, kernel_size=kernelSize, input_shape=im_shape, activation=ip_activation)
  cnn.add(ip_conv_0)
  ip_conv_0_1 = Conv2D(filters=64, kernel_size=kernelSize, activation=ip_activation)
  cnn.add(ip_conv_0_1)
  pool_0 = MaxPool2D(pool_size=(2, 2), strides=(2, 2), padding="same")
  cnn.add(pool_0)
  drop_layer_0 = Dropout(0.2)
  cnn.add(drop_layer_0)
  flat_layer_0 = Flatten()
  cnn.add(Flatten())
  h_dense_0 = Dense(units=128, activation=ip_activation, kernel_initializer='uniform')
  cnn.add(h_dense_0)
  h_dense_1 = Dense(units=64, activation=ip_activation, kernel_initializer='uniform')
  cnn.add(h_dense_1)
  
  op_activation = 'softmax'
  output_layer = Dense(units=n_classes, activation=op_activation, kernel_initializer='uniform')
  cnn.add(output_layer)#&lt;---------error
  
  TypeError: softmax() got an unexpected keyword argument 'axis'
  </code></pre>