log_softmax

Contents

log_softmax#

class brainpy.math.log_softmax(x, axis=-1)[source]#

Log-Softmax function.

Computes the logarithm of the softmax function, which rescales elements to the range \([-\infty, 0)\).

\[\mathrm{log\_softmax}(x) = \log \left( \frac{\exp(x_i)}{\sum_j \exp(x_j)} \right)\]
Parameters:
  • x (ArrayType) – The input array.

  • axis (int) – The axis or axes along which the log_softmax should be computed. Either an integer or a tuple of integers.