---
title: MLCComparisonLayer
framework: ML Compute
role: symbol
role_heading: Class
platforms: [iOS 14.5+, iPadOS 14.5+, Mac Catalyst 14.5+, macOS 11.3+, tvOS 14.5+]
path: mlcompute/mlccomparisonlayer
---

# MLCComparisonLayer

A layer that performs elementwise comparison of two tensors.

## Declaration

```swift
class MLCComparisonLayer
```

## Overview

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 you specify.

## Topics

### Creating Comparison Layers

- [init(operation:)](mlcompute/mlccomparisonlayer/init(operation:).md)
- [MLCComparisonOperation](mlcompute/mlccomparisonoperation.md)

### Inspecting Comparison Layers

- [operation](mlcompute/mlccomparisonlayer/operation.md)

## Relationships

### Inherits From

- [MLCLayer](mlcompute/mlclayer.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

### Math Layers

- [MLCArithmeticLayer](mlcompute/mlcarithmeticlayer.md)
- [MLCReductionLayer](mlcompute/mlcreductionlayer.md)
- [MLCMatMulLayer](mlcompute/mlcmatmullayer.md)
- [MLCFullyConnectedLayer](mlcompute/mlcfullyconnectedlayer.md)
- [MLCGramMatrixLayer](mlcompute/mlcgrammatrixlayer.md)
