---
title: "hingeLoss(reductionType:weight:)"
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/mlclosslayer/hingeloss(reductiontype:weight:)"
---

# hingeLoss(reductionType:weight:)

Creates a hinge loss layer with the reduction type and weight you specify.

## Declaration

```swift
class func hingeLoss(reductionType: MLCReductionType, weight: Float) -> Self
```

## Parameters

- `reductionType`: The reduction operation type.
- `weight`: A scalar floating-point weight value.

## Return Value

Return Value A hinge loss layer.

## See Also

### Creating Loss Layers with Scalar Weights

- [softmaxCrossEntropy(reductionType:labelSmoothing:classCount:weight:)](mlcompute/mlclosslayer/softmaxcrossentropy(reductiontype:labelsmoothing:classcount:weight:).md)
- [categoricalCrossEntropy(reductionType:labelSmoothing:classCount:weight:)](mlcompute/mlclosslayer/categoricalcrossentropy(reductiontype:labelsmoothing:classcount:weight:).md)
- [sigmoidCrossEntropy(reductionType:labelSmoothing:weight:)](mlcompute/mlclosslayer/sigmoidcrossentropy(reductiontype:labelsmoothing:weight:).md)
- [log(reductionType:epsilon:weight:)](mlcompute/mlclosslayer/log(reductiontype:epsilon:weight:).md)
- [huberLoss(reductionType:delta:weight:)](mlcompute/mlclosslayer/huberloss(reductiontype:delta:weight:).md)
- [meanAbsoluteError(reductionType:weight:)](mlcompute/mlclosslayer/meanabsoluteerror(reductiontype:weight:).md)
- [meanSquaredError(reductionType:weight:)](mlcompute/mlclosslayer/meansquarederror(reductiontype:weight:).md)
- [cosineDistance(reductionType:weight:)](mlcompute/mlclosslayer/cosinedistance(reductiontype:weight:).md)
