<!--
{
  "availability" : [
    "iOS: 14.5.0 - 17.4.0",
    "iPadOS: 14.5.0 - 17.4.0",
    "macCatalyst: 14.5.0 - 17.4.0",
    "macOS: 11.3.0 - 14.3.0",
    "tvOS: 14.5.0 - 17.4.0"
  ],
  "documentType" : "symbol",
  "framework" : "MLCompute",
  "identifier" : "/documentation/MLCompute/MLCComparisonLayer",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "ML Compute"
    ],
    "preciseIdentifier" : "c:objc(cs)MLCComparisonLayer"
  },
  "title" : "MLCComparisonLayer"
}
-->

# MLCComparisonLayer

A layer that performs elementwise comparison of two tensors.

```
class MLCComparisonLayer
```

## Overview

The layer returns a tensor with the shape equal to the largest shape of operations. It fills with the Boolean value `result[i] = op1[i] ? op2[i]`, where `?` corresponds to the  [`MLCComparisonOperation`](/documentation/MLCompute/MLCComparisonOperation) you specify.

## Topics

### Creating Comparison Layers

[`init(operation:)`](/documentation/MLCompute/MLCComparisonLayer/init(operation:))

Creates a comparison layer with the operation you specify.

[`MLCComparisonOperation`](/documentation/MLCompute/MLCComparisonOperation)

A comparison operation.

### Inspecting Comparison Layers

[`operation`](/documentation/MLCompute/MLCComparisonLayer/operation)

The comparison layer’s operation.



---

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)