Skip to content
fn

softmax_op

→TensorImplPtr
int softmax_op(const int & a, int axis)

Python wrappers

Public Python APIs implemented by this engine symbols.

Numerically stable softmax pi=exi/∑jexjp_i = e^{x_i} / \sum_j e^{x_j} along axis.

See Also

log_softmax_op : Numerically advantageous log-domain variant for downstream NLL / cross-entropy losses. SoftmaxBackward : Autograd node implementing the gradient rule.

Parameters

aTensorImplPtr
Input logits.
axisint
Axis along which to normalise. Negative values count from the end.

Returns

TensorImplPtr

Output probabilities with the same shape and dtype as a.