<!--
{
  "availability" : [
    "iOS: 10.0.0 -",
    "iPadOS: 10.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.12.0 -",
    "tvOS: 10.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 3.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Accelerate",
  "identifier" : "/documentation/Accelerate/BNNSActivationFunction/BNNSActivationFunctionScaledTanh",
  "metadataVersion" : "0.1.0",
  "role" : "Enumeration Case",
  "symbol" : {
    "kind" : "Enumeration Case",
    "modules" : [
      "Accelerate"
    ],
    "preciseIdentifier" : "c:@EA@BNNSActivationFunction@BNNSActivationFunctionScaledTanh"
  },
  "title" : "BNNSActivationFunctionScaledTanh"
}
-->

# BNNSActivationFunctionScaledTanh

An activation function that returns the scaled hyperbolic tangent of its input.

```
BNNSActivationFunctionScaledTanh
```

## Discussion

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

```c
alpha*tanh(x*beta)
```

Use `alpha` and `beta` to specify the scale and input multiplier:

```swift
var activation = BNNSActivation(function: .scaledTanh, 
                                alpha: 1, 
                                beta: 0.5)
```

The following illustrates the output that the activation function generates from inputs in the range `-10...10`:

![Graph that shows input values for the activation function on horizontal axis and its output values on vertical axis. ](images/com.apple.accelerate/media-3401547@2x.png)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)