pymoose.softmax#

pymoose.softmax(x, axis, upmost_index, placement=None)[source]#

Softmax function.

\[\mathrm{softmax}(x) = \frac{\exp(x_i)}{\sum_j \exp(x_j)}\]
Parameters
  • x – A tensor.

  • axis – The dimension along which the softmax divisor’s sum-reduce should be computed.

  • upmost_index – The max index that should be used for computing the softmax divisor’s sum-reduce. Generally, this should be the size of the axis dimension of x.

  • placement – An optional Placement to pin this operation to.

Returns

Result of applying the softmax function on x along the given axis.