<!--
{
  "availability" : [
    "iOS: 14.0.0 - 17.4.0",
    "iPadOS: 14.0.0 - 17.4.0",
    "macCatalyst: 14.0.0 - 17.4.0",
    "macOS: 11.0.0 - 14.3.0",
    "tvOS: 14.0.0 - 17.4.0"
  ],
  "documentType" : "symbol",
  "framework" : "MLCompute",
  "identifier" : "/documentation/MLCompute/MLCActivationDescriptor/init(type:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "ML Compute"
    ],
    "preciseIdentifier" : "c:objc(cs)MLCActivationDescriptor(cm)descriptorWithType:"
  },
  "title" : "init(type:)"
}
-->

# init(type:)

Creates an activation descriptor with the activation type you specify.

```
convenience init?(type activationType: MLCActivationType)
```

## Parameters

`activationType`

A type of activation function.

## Discussion

Use this initializer to create one of the following activation descriptors:

- Absolute: `f(x) = fabs(x)`

Activation type: [`MLCActivationType.absolute`](/documentation/MLCompute/MLCActivationType/absolute)

- GELU: `f(x) = x * CDF(x)`

Activation type: [`MLCActivationType.gelu`](/documentation/MLCompute/MLCActivationType/gelu)

- Hard Swish: `f(x) = 0, if x <= -3`

`f(x) = x, if x >= +3`

`f(x) = x * (x + 3)/6`

Activation type: [`MLCActivationType.hardSwish`](/documentation/MLCompute/MLCActivationType/hardSwish)

- Identity: `f(x) = x`

Activation type: [`MLCActivationType.none`](/documentation/MLCompute/MLCActivationType/none)

- LogSigmoid: `f(x) = log(1 / (1 + exp(-x)))`

Activation type: [`MLCActivationType.logSigmoid`](/documentation/MLCompute/MLCActivationType/logSigmoid)

- Parametric Soft Sign: `f(x) = x / (1 + abs(x))`

Activation type: [`MLCActivationType.softSign`](/documentation/MLCompute/MLCActivationType/softSign)

- SELU: `f(x) = scale * (max(0, x) + min(0, α * (exp(x)−1)))`, where:

`α = 1.6732632423543772848170429916717`

`scale = 1.0507009873554804934193349852946`

Activation type: [`MLCActivationType.selu`](/documentation/MLCompute/MLCActivationType/selu)

- Sigmoid: `f(x) = 1 / (1 + e⁻ˣ)`

Activation type: [`MLCActivationType.sigmoid`](/documentation/MLCompute/MLCActivationType/sigmoid)

- TanhShrink: `f(x) = x - tanh(x)`

Activation type: [`MLCActivationType.tanhShrink`](/documentation/MLCompute/MLCActivationType/tanhShrink)

---

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)