---
title: MLCLossLayer
framework: ML Compute
role: symbol
role_heading: Class
platforms: [iOS 14.0+, iPadOS 14.0+, Mac Catalyst 14.0+, macOS 11.0+, tvOS 14.0+]
path: mlcompute/mlclosslayer
---

# MLCLossLayer

A layer that estimates the inaccuracies of the model to reduce the loss on the next evaluation.

## Declaration

```swift
class MLCLossLayer
```

## Topics

### Creating Loss Layers with Descriptors

- [init(descriptor:)](mlcompute/mlclosslayer/init(descriptor:).md)
- [init(descriptor:weights:)](mlcompute/mlclosslayer/init(descriptor:weights:).md)
- [MLCLossDescriptor](mlcompute/mlclossdescriptor.md)
- [MLCLossType](mlcompute/mlclosstype.md)

### 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)
- [hingeLoss(reductionType:weight:)](mlcompute/mlclosslayer/hingeloss(reductiontype:weight:).md)
- [cosineDistance(reductionType:weight:)](mlcompute/mlclosslayer/cosinedistance(reductiontype:weight:).md)

### Creating Loss Layers with Tensor Weights

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

### Inspecting Loss Layers

- [descriptor](mlcompute/mlclosslayer/descriptor.md)
- [weights](mlcompute/mlclosslayer/weights.md)

## Relationships

### Inherits From

- [MLCLayer](mlcompute/mlclayer.md)

### Inherited By

- [MLCYOLOLossLayer](mlcompute/mlcyololosslayer.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)

## See Also

### Loss Layers

- [MLCYOLOLossLayer](mlcompute/mlcyololosslayer.md)
