.. _op_ai_onnx_Softmax: Softmax ======= - **Domain**: ``ai.onnx`` - **Since version**: 13 The operator computes the normalized exponential values for the given input. The "axis" attribute indicates the dimension along which Softmax is performed. The output tensor has the same shape as the input tensor. **Inputs** - **input** (*T*): The input tensor of rank >= axis. **Outputs** - **output** (*T*): The output values with the same shape as the input tensor. **Attributes** - **axis** (*int*): Describes the dimension Softmax will be performed on. Negative value means counting dimensions from the back. **Type Constraints** - **T**: Constrain input and output types to float tensors. Allowed types: tensor(bfloat16), tensor(double), tensor(float), tensor(float16). Examples -------- **test_cc_softmax** .. code-block:: text Node: Softmax(input) -> (output) Attributes: axis = 1 .. code-block:: text Inputs: input: shape=(2, 3), dtype=float32 [[1., 2., 3.], [1., 2., 3.]] Outputs: output: shape=(2, 3), dtype=float32 [[0.09003057, 0.24472848, 0.66524094], [0.09003057, 0.24472848, 0.66524094]] **test_cc_softmax_default_axis** .. code-block:: text Node: Softmax(input) -> (output) .. code-block:: text Inputs: input: shape=(2, 3), dtype=float32 [[ 1., 2., 3.], [ 4., 1., -1.]] Outputs: output: shape=(2, 3), dtype=float32 [[0.09003057, 0.24472848, 0.66524094], [0.94649917, 0.04712342, 0.00637746]] Differences with previous version (11) -------------------------------------- **SchemaDiff**: ``Softmax`` (domain ``'ai.onnx'``) * old version: 11 * new version: 13 * breaking: **yes** **Breaking reasons:** * attribute 'axis' (changed): default value changed 1 -> -1 **Attributes:** * [BREAKING] changed 'axis': default value changed 1 -> -1 **Type constraints:** * changed 'T': added types: ['tensor(bfloat16)'] Version History --------------- - :doc:`Version 11 ` - :doc:`Version 1 `