---
title: softmax
framework: accelerate
role: symbol
role_heading: Type Property
path: accelerate/bnnsactivationfunction/softmax
---

# softmax

An activation function that returns the softmax function of its input.

## Declaration

```swift
static var softmax: BNNSActivationFunction { get }
```

## Discussion

Discussion This constant defines an activation function that returns values using the following formula:

The softmax function transforms a vector of real numbers into a vector of probabilities. Each probability in the result is in the range 0…1, and the sum of the probabilities is 1. For example, given and array that contains the values [3.0, 5.0, 1.0, 6.0, 2.0, 1.0, 4.0], the softmax function calculates the following values:  |   |   |   |   |   |   |   |  Changing the fourth element from 6.0 to 10.0 increases its probability to almost 1.0:  |   |   |   |   |   |   |   |

## See Also

### Activation Functions

- [abs](accelerate/bnnsactivationfunction/abs.md)
- [clamp](accelerate/bnnsactivationfunction/clamp.md)
- [identity](accelerate/bnnsactivationfunction/identity.md)
- [integerLinearSaturate](accelerate/bnnsactivationfunction/integerlinearsaturate.md)
- [integerLinearSaturatePerChannel](accelerate/bnnsactivationfunction/integerlinearsaturateperchannel.md)
- [leakyRectifiedLinear](accelerate/bnnsactivationfunction/leakyrectifiedlinear.md)
- [linear](accelerate/bnnsactivationfunction/linear.md)
- [rectifiedLinear](accelerate/bnnsactivationfunction/rectifiedlinear.md)
- [scaledTanh](accelerate/bnnsactivationfunction/scaledtanh.md)
- [sigmoid](accelerate/bnnsactivationfunction/sigmoid.md)
- [tanh](accelerate/bnnsactivationfunction/tanh.md)
