softmax

dragon.vm.tensorflow.keras.activations.softmax(
  x,
  axis=- 1,
  **kwargs
)[source]

Apply the softmax function to input.

The Softmax function is defined as:

\[\text{Softmax}(x_{i}) = \frac{\exp(x_{i})}{\sum_{j} \exp(x_{j})} \]

Examples:

x = tf.constant([-1, 0, 1], 'float32')
print(tf.keras.activations.softmax(x, inplace=False))
Parameters:
  • x (dragon.Tensor) – The input tensor.
  • axis (int, optional, default=-1) – The axis to reduce.
Returns:

dragon.Tensor – The output tensor.