---
title: "threshold(_:replacement:)"
framework: ML Compute
role: symbol
role_heading: Type Method
platforms: [iOS 14.0+, iPadOS 14.0+, Mac Catalyst 14.0+, macOS 11.0+, tvOS 14.0+]
path: "mlcompute/mlcactivationlayer/threshold(_:replacement:)"
---

# threshold(_:replacement:)

Creates an instance of a threshold activation layer using the threshold and replacement values you specify.

## Declaration

```swift
class func threshold(_ threshold: Float, replacement: Float) -> Self
```

## Parameters

- `threshold`: The threshold value.
- `replacement`: The replacement value.

## Return Value

Return Value A new MLCActivationLayer instance.

## Discussion

Discussion The threshold(_:replacement:) factory type method creates an activation descriptor using init(type:a:b:), where type = MLCActivationType.threshold, a = threshold, and b = replacement, and passes that descriptor to init(descriptor:).

## See Also

### Factory Methods

- [celu(a:)](mlcompute/mlcactivationlayer/celu(a:).md)
- [clamp(min:max:)](mlcompute/mlcactivationlayer/clamp(min:max:).md)
- [elu(a:)](mlcompute/mlcactivationlayer/elu(a:).md)
- [hardShrink(a:)](mlcompute/mlcactivationlayer/hardshrink(a:).md)
- [leakyReLU(negativeSlope:)](mlcompute/mlcactivationlayer/leakyrelu(negativeslope:).md)
- [linear(scale:bias:)](mlcompute/mlcactivationlayer/linear(scale:bias:).md)
- [relun(a:b:)](mlcompute/mlcactivationlayer/relun(a:b:).md)
- [softPlus(beta:)](mlcompute/mlcactivationlayer/softplus(beta:).md)
- [softShrink(a:)](mlcompute/mlcactivationlayer/softshrink(a:).md)
