---
title: "meanAbsoluteError(reductionType:weights:)"
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/meanabsoluteerror(reductiontype:weights:)"
---

# meanAbsoluteError(reductionType:weights:)

Creates a mean absolute loss layer with the reduction type and weights you specify.

## Declaration

```swift
class func meanAbsoluteError(reductionType: MLCReductionType, weights: MLCTensor?) -> Self
```

## Parameters

- `reductionType`: The reduction operation type.
- `weights`: The loss label weights tensor.

## Return Value

Return Value A mean absolute loss layer.

## See Also

### 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)
- [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)
