<!--
{
  "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/MLCLossLayer/softmaxCrossEntropy(reductionType:labelSmoothing:classCount:weight:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "ML Compute"
    ],
    "preciseIdentifier" : "c:objc(cs)MLCLossLayer(cm)softmaxCrossEntropyLossWithReductionType:labelSmoothing:classCount:weight:"
  },
  "title" : "softmaxCrossEntropy(reductionType:labelSmoothing:classCount:weight:)"
}
-->

# softmaxCrossEntropy(reductionType:labelSmoothing:classCount:weight:)

Creates a softmax cross entropy loss layer with the reduction type, label smoothing, number of classes, and weight you specify.

```
class func softmaxCrossEntropy(reductionType: MLCReductionType, labelSmoothing: Float, classCount: Int, weight: Float) -> Self
```

## Parameters

`reductionType`

The reduction operation type.

`labelSmoothing`

Label smoothing value.

`classCount`

The number of classes

`weight`

A scalar floating-point weight value.

## Return Value

A softmax cross entropy loss layer.

## Discussion

---

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)